Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
RANDU
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Pseudorandom number generator}} {{Use dmy dates|date=October 2020}} [[Image:Randu.png|thumb|right|[[Three-dimensional space|Three-dimensional plot]] of 100,000 values generated with RANDU. Each point represents 3 consecutive pseudorandom values. It is clearly seen that the points fall in 15 [[2D geometric model|two-dimensional]] [[Plane (mathematics)|planes]].]] '''RANDU'''<ref name=":0">Compaq Fortran Language Reference Manual (Order Number: AA-Q66SD-TK) September 1999 (formerly DIGITAL Fortran and DEC Fortran 90).</ref> is a [[linear congruential generator|linear congruential]] [[pseudorandom number generator]] (LCG) of the [[Park–Miller random number generator|Park–Miller type]], which was used primarily in the 1960s and 1970s.<ref name="Entacher-2000"> {{cite web | last = Entacher | first = Karl | title = A collection of classical pseudorandom number generators with linear structures – advanced version | date = June 2000 | url=http://random.mat.sbg.ac.at/results/karl/server/server.html | url-status=dead | archive-url=https://web.archive.org/web/20181118052935if_/http://random.mat.sbg.ac.at/results/karl/server/server.html | archive-date=2018-11-18 }}</ref> It is defined by the [[Recursion|recurrence]] : <math>V_{j+1} = 65539 \cdot V_j \bmod 2^{31}</math> with the initial seed number <math>V_0</math> as an [[even and odd numbers|odd number]]. It generates pseudorandom [[integer number|integers]] <math>V_j</math> which are [[uniform distribution (discrete)|uniformly distributed]] in the interval {{nowrap|[1, 2<sup>31</sup> − 1]}}, but in practical applications are often mapped into pseudorandom [[rational number|rationals]] <math>X_j</math> in the interval {{nowrap|(0, 1)}}, by the formula : <math>X_j = \frac{V_j}{2^{31}}.</math> IBM's RANDU is widely considered to be one of the most ill-conceived random number generators ever designed,<ref>[[Donald Knuth|Knuth D. E.]] ''[[The Art of Computer Programming]]'', Volume 2: ''Seminumerical Algorithms'', 2nd edition. Addison-Wesley, 1981. {{ISBN|0-201-03822-6}}. Section 3.3.4, p. 104: "its very name RANDU is enough to bring dismay into the eyes and stomachs of many computer scientists!" [Extensive coverage of statistical tests for non-randomness.]</ref> and was described as "truly horrible" by [[Donald Knuth]].<ref>Knuth (1998), p. 188.{{full citation needed|date=February 2024}}</ref> It fails the [[spectral test]] badly for dimensions greater than 2, as shown below. The reason for choosing these particular values for the multiplier and modulus had been that with a 32-bit-integer word size, the arithmetic of mod 2<sup>31</sup> and <math>65539 = 2^{16} + 3</math> calculations could be done quickly, using [[bitwise operator]]s in hardware, but the values were chosen for computational convenience, not statistical quality. == Problems with multiplier and modulus == For any [[linear congruential generator]] with modulus ''m'' used to generate points in ''n''-dimensional space, the points fall in no more than <math>(n! \times m)^{1/n}</math> parallel hyperplanes.<ref name=marsaglia>{{cite journal |author=Marsaglia, George |year=1968 |title=Random Numbers Fall Mainly in the Planes |journal=Proc. Natl. Acad. Sci. U.S.A. |volume=61 |issue=1 |pages=25–28 |doi=10.1073/pnas.61.1.25 |pmc=285899 |pmid=16591687 |bibcode=1968PNAS...61...25M |doi-access=free}}</ref> This indicates that low-modulus LCGs are unsuited to high-dimensional [[Monte Carlo simulation]]. For ''m'' = 2<sup>31</sup> and ''n'' = 3, an LCG could have up to 2344 planes, theoretical maximum. A much tighter upper bound is proved in the same Marsaglia paper to be the sum of the absolute values of all the coefficients of the hyperplanes in standard form. That is, if the hyperplanes are of the form ''Ax''<sub>1</sub> + ''Bx''<sub>2</sub> + ''Cx''<sub>3</sub> = some integer such as 0, 1, 2 etc, then the maximum number of planes is |''A''| + |''B''| + |''C''|.<ref name=marsaglia/> Now we examine the values of multiplier 65539 and modulus 2<sup>31</sup> chosen for RANDU. Consider the following calculation where every term should be taken mod 2<sup>31</sup>. Start by writing the recursive relation as : <math>x_{k+2} = (2^{16} + 3) x_{k+1} = (2^{16} + 3)^2 x_k,</math> which after expanding the quadratic factor becomes : <math>x_{k+2} = (2^{32} + 6 \cdot 2^{16} + 9) x_k =[6 \cdot (2^{16} + 3) - 9] x_{k}</math> (because {{nowrap|2<sup>32</sup> mod 2<sup>31</sup> {{=}} 0}}) and allows us to show the correlation between three points as : <math>x_{k+2} = 6x_{k+1} - 9x_{k}.</math> Summing the absolute values of the coefficients, we get no more than 16 planes in 3D, becoming only 15 planes on closer examination, as shown in the diagram above. Even by the standards of LCGs, this shows that RANDU is terrible: using RANDU for sampling a [[unit cube]] will only sample 15 parallel planes, not even close to the upper limit of <math>\Big\lfloor\big(2^{31} \times 3!\big)^{1/3}\Big\rfloor = 2344</math> planes. As a result of the wide use of RANDU in the early 1970s, many results from that time are seen as suspicious.<ref name="press92">{{cite book |author=Press, William H. |year=1992 |title=Numerical Recipes in Fortran 77: The Art of Scientific Computing |edition=2nd |isbn=0-521-43064-X |display-authors=etal}}</ref> This misbehavior was already detected in 1963<ref>{{Cite journal |last=Greenberger |first=Martin |date=1965-03-01 |title=Method in randomness |url=https://doi.org/10.1145/363791.363827 |journal=Commun. ACM |volume=8 |issue=3 |pages=177–179 |doi=10.1145/363791.363827 |issn=0001-0782}}</ref> on a 36-bit computer, and carefully reimplemented{{clarify|date=June 2016}} on the 32-bit [[IBM System/360]]. It was believed to have been widely purged by the early 1990s<ref>{{cite web |url=http://tex.loria.fr/litte/knuth-interview |title=Donald Knuth – Computer Literacy Bookshops Interview |date=1993-12-07 |archive-url=https://web.archive.org/web/20220328201420/http://tex.loria.fr/litte/knuth-interview |archive-date=2022-03-28 |url-status=dead}}</ref> but there were still FORTRAN compilers using it as late as 1999.<ref name=":0" /> ==Sample output== The start of the RANDU's output period for the initial seed <math>V_0 = 1</math> is : 1, 65539, 393225, 1769499, 7077969, 26542323, … {{OEIS|A096555}}. ==References== {{Reflist|30em}} == External links== * {{Wikiquote-inline|RANDU}} [[Category:Pseudorandom number generators]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Cite book
(
edit
)
Template:Cite journal
(
edit
)
Template:Cite web
(
edit
)
Template:Clarify
(
edit
)
Template:Full citation needed
(
edit
)
Template:ISBN
(
edit
)
Template:Nowrap
(
edit
)
Template:OEIS
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Use dmy dates
(
edit
)
Template:Wikiquote-inline
(
edit
)