help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rand("state")


From: Mike Miller
Subject: Re: rand("state")
Date: Wed, 15 Feb 2006 20:30:07 -0600 (CST)

On Wed, 15 Feb 2006, Paul Kienzle wrote:

state(625) is the position in the sequence.

If the state vector is shorter than 625 or the position value points outside the array, then I mix up the array a bit to make sure that bad states are avoid (e.g., all zeros is bad). This is why you are getting a different seed from rand("state") than you put in with rand("state",x).

Given

  seeds = randint(100,1,1e9);
  save seedfile seeds

You can get a reproducible effecting using:

  load seedfile
  for s = seeds, sim(rand("state",seeds(i))); end

You don't get any improvement in the randomness by using longer seeds.

I've corrected the documentation so that it reports the state vector is a row vector. For compatibility it should be a string, but that is an issue for another day.


That is interesting. The one thing I don't understand is why there is a 625-integer state if I get no improvement in randomness for using 625 integers for the seed instead of a single integer. I'm probably confusing "state" and "seed." With a period of about 4.3*10^6001, I would think that using a seed that is always less than 10^9 would be allowing the user to access only a small minority of the random sequences available.

Mike



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]