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)
Obsoleto a partir de la versión 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)). Nuevo en la versión 1.5.2.

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

Ver Sobre este documento... para obtener información sobre sugerencias.