
SeedRandom oddity/flaw/bug/imperfection
Posted:
Nov 12, 1996 1:23 PM


Dear readers of comp.softsys.math.mathematica,
I would like to bring to your attention a flaw I suspect in seeding the integer random number generator of Mathematica. This is for your information  I mailed it to support@wolfram.com $VersionNumber > 2.2 $Version > Solaris 2.2 (April 28, 1993)
Symptom  Random[Integer, {...}] ignores some of the bits of the seed that was previously given to SeedRandom[...]. Example:
SeedRandom[3] Table[Random[Integer,{0, 99}], {5}] > {94, 88, 87, 55, 30} SeedRandom[131] Table[Random[Integer,{0, 99}], {5}] > {94, 88, 87, 55, 30}
Regularities  I found the following patterns in the influence of the sees (or lack of influence). Maybe a person with access to the source code can interprete these patterns. * For seeds below 2^31, the bits 6,7, and 24 are ignored; the corresponding binary digits have the respective values 2^6(==64), 2^7 (as in the example above), and 2^24. * For bigger seeds (i.e., not machine size integers), the bits 6, 7, and 24 do take effect, but the bits 40, 54, 55, 72, 86, and 87 are always ignored. On the other hand, adding, e.g., 2^50 always has an influence on the pseudo random sequence that will be generated. I did not check for seeds above 2^100.
Other Aspects of Random[] etc.  The effect does not depend on the range of integers requested in the call to Random. Realvalued random numbers (e.g. Random[]) are not affected. $RandomState, the state of the random number generator, is an integer and seems evenly distributed with equal probability (1/2) in either of the intervals [0,2^1854] or [2^1854, 3*2^1854]. Generating an integer random number changes $RandomState generating a real does not (!); these seem to be disjoint random streams.
Workaround  Multiply the seeds by 5 (or 256).
Hoping this might help some of you, or you might help me
Christian Brechbuehler Communication Technology Laboratory, Image Science Group Swiss Federal Institute of Technology (ETH), Zurich

