5.3.1 The Random Number Generator Interface

The Random Number Generator interface describes the methods which are available for all random number generators. This will be enhanced in future releases of Python.

In this release of Python, the modules random, whrandom, and instances of the whrandom.whrandom class all conform to this interface.

choice (seq)
Chooses a random element from the non-empty sequence seq and returns it.

randint (a, b)
Deprecated since release 2.0. Use randrange() instead.

Returns a random integer N such that a <= N <= b.

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

randrange ([start,] stop[, step])
Return a randomly selected element from range(start, stop, step). This is equivalent to choice(range(start, stop, step)). New in version 1.5.2.

uniform (a, b)
Returns a random real number N such that a <= N < b.

See About this document... for information on suggesting changes.