Random number generation capabilities, speed, and thread safety in stdlib vary from version to version of Python. In addition, attempts to use an OS-specific random number source can result in unexpected exceptions being raised. Also, a bug in Python 2.3.0 can lead to a reduction in entropy, and a bug in Python 2.4.0 and 2.4.1 can result in exceptions related to open filehandles on some multithreaded Posix platforms. This module works around as many of these issues as it can by defining random number generator classes that can be used safely by multiple threads, using the best random number sources available. They support all versions of Python from 2.1 up, and fall back on more reliable generators when exception conditions occur. In addition, convenience functions equivalent to random.random() and os.urandom() are exposed. Copyright 2006 Fourthought, Inc. (USA). Detailed license and copyright information: http://4suite.org/COPYRIGHT Project home, documentation, distributions: http://4suite.org/
Classes:
|
Functions:
|
Globals:
|
Implements getrandbits() in all versions of Python. Also adds getrandbytes(), which returns a str of bytes.
mu is the mean, and sigma is the standard deviation. Thread-safe.
None or no argument seeds from current time or from an operating system specific randomness source if available. If a is not None or an int or long, hash(a) is used instead.
Calls to seed(), jumpahead(), getstate() and setstate() only affect the fallback FtRandom instance. Implements getrandbits() in all versions of Python. Also adds getrandbytes(), which returns a str of bytes.
Return a string of n random bytes suitable for cryptographic use.
Calls to seed(), jumpahead(), getstate() and setstate() only affect the fallback FtRandom instance. Implements getrandbits() in all versions of Python. Also adds getrandbytes(), which returns a str of bytes.