PyDocs

Numeric and Mathematical Modules

random

Random variable generators.

    bytes
    -----
           uniform bytes (values between 0 and 255)

    integers
    --------
           uniform within range

    sequences
    ---------
           pick random element
           pick random sample
           pick weighted random sample
           generate random permutation

    distributions on the real line:
    ------------------------------
           uniform
           triangular
           normal (Gaussian)
           lognormal
           negative exponential
           gamma
           beta
           pareto
           Weibull

    distributions on the circle (angles 0 to 2pi)
    ---------------------------------------------
           circular uniform
           von Mises

    discrete distributions
    ----------------------
           binomial


General notes on the underlying Mersenne Twister core generator:

* The period is 2**19937-1.
* It is one of the most extensively tested generators in existence.
* The random() method is implemented in C, executes in a single Python step,
  and is, therefore, threadsafe.
Symbols in random

b

betavariate
Beta distribution.
binomialvariate
Binomial random variable.

c

choice
Choose a random element from a non-empty sequence.
choices
Return a k sized list of population elements chosen with replacement.

e

expovariate
Exponential distribution.

g

gammavariate
Gamma distribution.
gauss
Gaussian distribution.
getrandbits
getrandbits(k) -> x.
getstate
Return internal state; can be passed to setstate() later.

l

lognormvariate
Log normal distribution.

n

normalvariate
Normal distribution.

p

paretovariate
Pareto distribution.

r

randbytes
Generate n random bytes.
randint
Return random integer in range [a, b], including both end points.
random
random() -> x in the interval [0, 1).
Random
Random number generator base class used by bound module functions.
randrange
Choose a random item from range(stop) or range(start, stop[, step]).

s

sample
Chooses k unique random elements from a population sequence.
seed
Initialize internal state from a seed.
setstate
Restore internal state from object returned by getstate().
shuffle
Shuffle list x in place, and return None.
SystemRandom
Alternate random number generator using sources provided by the operating system (such as /dev/urandom on Unix or CryptGenRandom on Windows).

t

triangular
Triangular distribution.

u

uniform
Get a random number in the range [a, b) or [a, b] depending on rounding.

v

vonmisesvariate
Circular data distribution.

w

weibullvariate
Weibull distribution.