summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2006-02-21 19:19:00 (GMT)
committerTim Peters <tim.peters@gmail.com>2006-02-21 19:19:00 (GMT)
commitd34350e47e0010c1ab2a8d62b73567cecf1f880a (patch)
tree1ace25ba54a3495c271b99f5a1273496497bdba1
parentb075fcea3a12ee7bbf63d171e3336669f2efadc5 (diff)
downloadcpython-d34350e47e0010c1ab2a8d62b73567cecf1f880a.zip
cpython-d34350e47e0010c1ab2a8d62b73567cecf1f880a.tar.gz
cpython-d34350e47e0010c1ab2a8d62b73567cecf1f880a.tar.bz2
At Brian Wichmann's request, added words warning against
using the old Wichmann-Hill generator, Also pointed to a newer version of his generator, and weakened the claim about what jumpahead() does now. Note sure I got the LaTeX entirely correct for \seeurl. If it's broken, please fix it ;-) Bugfix candidate! (These changes make just as much sense for 2.4.)
-rw-r--r--Doc/lib/librandom.tex17
1 files changed, 13 insertions, 4 deletions
diff --git a/Doc/lib/librandom.tex b/Doc/lib/librandom.tex
index f95f106..7a1b982 100644
--- a/Doc/lib/librandom.tex
+++ b/Doc/lib/librandom.tex
@@ -34,7 +34,7 @@ hidden instance of the \class{random.Random} class. You can
instantiate your own instances of \class{Random} to get generators
that don't share state. This is especially useful for multi-threaded
programs, creating a different instance of \class{Random} for each
-thread, and using the \method{jumpahead()} method to ensure that the
+thread, and using the \method{jumpahead()} method to make it likely that the
generated sequences seen by each thread don't overlap.
Class \class{Random} can also be subclassed if you want to use a
@@ -47,10 +47,14 @@ over an arbitrarily large range.
\versionadded[the \method{getrandombits()} method]{2.4}
As an example of subclassing, the \module{random} module provides
-the \class{WichmannHill} class which implements an alternative generator
+the \class{WichmannHill} class that implements an alternative generator
in pure Python. The class provides a backward compatible way to
-reproduce results from earlier versions of Python which used the
-Wichmann-Hill algorithm as the core generator.
+reproduce results from earlier versions of Python, which used the
+Wichmann-Hill algorithm as the core generator. Note that this Wichmann-Hill
+generator can no longer be recommended: its period is too short by
+contemporary standards, and the sequence generated is known to fail some
+stringent randomness tests. See the references below for a recent
+variant that repairs these flaws.
\versionchanged[Substituted MersenneTwister for Wichmann-Hill]{2.3}
@@ -273,4 +277,9 @@ called.
\seetext{Wichmann, B. A. \& Hill, I. D., ``Algorithm AS 183:
An efficient and portable pseudo-random number generator'',
\citetitle{Applied Statistics} 31 (1982) 188-190.}
+
+ \seeurl{http://www.npl.co.uk/ssfm/download/abstracts.html#196}{A modern
+ variation of the Wichmann-Hill generator that greatly increases
+ the period, and passes now-standard statistical tests that the
+ original generator failed.}
\end{seealso}