random

The random module provides a variety of functions for generating pseudo-random numbers as well as functions for randomly generating values according to various distributions on the real numbers. Most of the functions in this module depend on the function random(), which generates uniformly distributed numbers in the range [0.0, 1.0) using the Mersenne Twister generator.

The following functions are used to control the state of the underlying random number generator:

						seed([x])

Initializes the random number generator. If x is omitted or None, the system time is used to seed the generator. Otherwise, if x is an integer or long integer, its value is used. If x is not an integer, it must be a hashable object and the value of hash(x) is used ...

Get Python: Essential Reference, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.