Python Random

random is a module for pseudo-random number generation.


Usage

Function

Meaning

betavariate()

choice()

choices()

expovariate()

gammavariate()

gauss(mu, sigma)

return a float from the Gaussian distribution characterized by mu and sigma

getrandbits()

lognormvariate()

normalvariate(mu, sigma)

return a float from the normal distribution characterized by mu and sigma

paretovariate()

randbytes()

randint()

random()

return a float between 0 and 1, inclusive of 0

randrange()

sample()

seed()

shuffle()

triangular()

uniform(a, b)

return a float between a and b, inclusive (except when floating point rounding hits the high value)

vonmisesvariate()

weibullvariate()


See also

Python random module documentation

Python Module of the Day article for random


CategoryRicottone