Re: Q: Random[]
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg1632] Re: [mg1598] Q: Random[]
- From: Richard Bowman <rbowman at bridgewater.edu>
- Date: Fri, 7 Jul 1995 01:23:08 -0400
On Tue, 4 Jul 1995, Ron Elsner wrote: > I have 2 questions about Random[]: > > 1. What is its period? This affects how large a Monte-Carlo I > can run before losing independence of trials. > > 2. I understand it gets its seed from the clock. When debugging > Monte-Carlo code, I like to set the seed so I can repeat runs. Is > this possible for Random[], and if so how? (The seed initiates the > sequence of psuedo-random numbers.) In preparation for an article that has just been published, I studied various pseudo-random number generators including Mathematica's Random[]. My conclusion was that I could not see any visible structure in the 2-tuple or 3-tuple or noise-sphere plots of its output for 5000 points. What its effective period is must be greater than 5000. The article uses Mma's graphical and statistical capabilities to evaluate the selected random number generators. The citation is: Richard L. Bowman, Evaluating Pseudo-Random Number Generators. _Computers & Graphics_ 19, 315-324 (1995). (I have a few copies that I could mail to anyone _especially_ interested in one.) The second question is easier to answer. Simply use the function SeedRandom[n] where n is an integer to get Random[] to always give the same sequence. To seed from the clock, simply remove n in the function. See p 552 of Wolfram's book. Richard L. Bowman Dept. of Physics Bridgewater College Bridgewater, VA 22812 703-828-2501 <rbowman at bridgewater.edu>