diff options
author | Raymond Hettinger <python@rcn.com> | 2002-12-29 23:03:38 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2002-12-29 23:03:38 (GMT) |
commit | 40f621709286a7a0f7e6f260c0fd020d0fac0de0 (patch) | |
tree | bd602fee432a253a0f454fc696d14734f18dd915 /Misc | |
parent | 5e65ce671c3d3113035dd7783b79d395c9d71b3d (diff) | |
download | cpython-40f621709286a7a0f7e6f260c0fd020d0fac0de0.zip cpython-40f621709286a7a0f7e6f260c0fd020d0fac0de0.tar.gz cpython-40f621709286a7a0f7e6f260c0fd020d0fac0de0.tar.bz2 |
SF patch 658251: Install a C implementation of the Mersenne Twister as the
core generator for random.py.
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/NEWS | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -545,6 +545,25 @@ Library and 'stop' arguments so long as each is in the range of Python's bounded integers. +- Thanks to Raymond Hettinger, random.random() now uses a new core + generator. The Mersenne Twister algorithm is implemented in C, + threadsafe, faster than the previous generator, has an astronomically + large period (2**19937-1), creates random floats to full 53-bit + precision, and may be the most widely tested random number generator + in existence. + + The random.jumpahead(n) method has different semantics for the new + generator. Instead of jumping n steps ahead, it uses n and the + existing state to create a new state. This means that jumpahead() + continues to support multi-threaded code needing generators of + non-overlapping sequences. However, it will break code which relies + on jumpahead moving a specific number of steps forward. + + The attributes random.whseed and random.__whseed have no meaning for + the new generator. Code using these attributes should switch to a + new class, random.WichmannHill which is provided for backward + compatibility and to make an alternate generator available. + - New "algorithms" module: heapq, implements a heap queue. Thanks to Kevin O'Connor for the code and François Pinard for an entertaining write-up explaining the theory and practical uses of heaps. |