random.seed()

random.seed(a=None, version=2) Initialize the random number generator. If a is omitted or None, the current system time is used. If randomness sources are provided by the operating system, they are used instead of the system time (see the os.urandom() function for details on availability). If a is an int, it is used directly. With version 2 (the default), a str, bytes, or bytearray object gets converted to an int and all of its bits are used. With version 1, the hash() of a is used instead.

random.sample()

random.sample(population, k) Return a k length list of unique elements chosen from the population sequence or set. Used for random sampling without replacement. Returns a new list containing elements from the population while leaving the original population unchanged. The resulting list is in selection order so that all sub-slices will also be valid random samples. This allows raffle winners (the sample) to be partitioned into grand prize and second place winners (the subslices). Members of

random.randrange()

random.randrange(stop) random.randrange(start, stop[, step]) Return a randomly selected element from range(start, stop, step). This is equivalent to choice(range(start, stop, step)), but doesn’t actually build a range object. The positional argument pattern matches that of range(). Keyword arguments should not be used because the function may use them in unexpected ways. Changed in version 3.2: randrange() is more sophisticated about producing equally distributed values. Formerly it used a s

random.random()

random.random() Return the next random floating point number in the range [0.0, 1.0).

random.randint()

random.randint(a, b) Return a random integer N such that a <= N <= b. Alias for randrange(a, b+1).

random.paretovariate()

random.paretovariate(alpha) Pareto distribution. alpha is the shape parameter.

random.normalvariate()

random.normalvariate(mu, sigma) Normal distribution. mu is the mean, and sigma is the standard deviation.

random.lognormvariate()

random.lognormvariate(mu, sigma) Log normal distribution. If you take the natural logarithm of this distribution, you’ll get a normal distribution with mean mu and standard deviation sigma. mu can have any value, and sigma must be greater than zero.

random.getstate()

random.getstate() Return an object capturing the current internal state of the generator. This object can be passed to setstate() to restore the state.

random.getrandbits()

random.getrandbits(k) Returns a Python integer with k random bits. This method is supplied with the MersenneTwister generator and some other generators may also provide it as an optional part of the API. When available, getrandbits() enables randrange() to handle arbitrarily large ranges.