diff options
author | Tim Peters <tim.peters@gmail.com> | 2006-06-10 22:51:45 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2006-06-10 22:51:45 (GMT) |
commit | 0e1159583c06fdf85d7d2dbe8b82e42565b9d166 (patch) | |
tree | daf957914ef0c11d8db52784d89859d9490811a2 /Lib/random.py | |
parent | 9a8ae8f46b999c199bb3c75778e710baa412c888 (diff) | |
download | cpython-0e1159583c06fdf85d7d2dbe8b82e42565b9d166.zip cpython-0e1159583c06fdf85d7d2dbe8b82e42565b9d166.tar.gz cpython-0e1159583c06fdf85d7d2dbe8b82e42565b9d166.tar.bz2 |
shuffle() doscstring: Removed warning about sequence length
versus generator period. While this was a real weakness of the
older WH generator for lists with just a few dozen elements,
and so could potentially bite the naive ;-), the Twister should
show excellent behavior up to at least 600 elements.
Module docstring: reflowed some jarringly short lines.
Diffstat (limited to 'Lib/random.py')
-rw-r--r-- | Lib/random.py | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/Lib/random.py b/Lib/random.py index 465f477..ae2d434 100644 --- a/Lib/random.py +++ b/Lib/random.py @@ -29,13 +29,12 @@ General notes on the underlying Mersenne Twister core generator: * The period is 2**19937-1. -* It is one of the most extensively tested generators in existence -* Without a direct way to compute N steps forward, the - semantics of jumpahead(n) are weakened to simply jump - to another distant state and rely on the large period - to avoid overlapping sequences. -* The random() method is implemented in C, executes in - a single Python step, and is, therefore, threadsafe. +* It is one of the most extensively tested generators in existence. +* Without a direct way to compute N steps forward, the semantics of + jumpahead(n) are weakened to simply jump to another distant state and rely + on the large period to avoid overlapping sequences. +* The random() method is implemented in C, executes in a single Python step, + and is, therefore, threadsafe. """ @@ -253,11 +252,6 @@ class Random(_random.Random): Optional arg random is a 0-argument function returning a random float in [0.0, 1.0); by default, the standard random.random. - - Note that for even rather small len(x), the total number of - permutations of x is larger than the period of most random number - generators; this implies that "most" permutations of a long - sequence can never be generated. """ if random is None: |