Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: SeedRandom oddity/flaw/bug/imperfection
Replies: 2   Last Post: Nov 15, 1996 3:10 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Christian Brechbuehler

Posts: 3
Registered: 12/7/04
SeedRandom oddity/flaw/bug/imperfection
Posted: Nov 12, 1996 1:23 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Dear readers of comp.soft-sys.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. Real-valued 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








Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.