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 19:37:19 -0600 (CST)

On Wed, 15 Feb 2006, Mike Miller wrote:

To summarize: I think this produces a good set of 100 random seeds for the MT generator:

stored_seeds = ceil( [ rand( 100, 624 ) * 2^32 , rand( 100, 1 ) * 624 ] );

That is a matrix of integers of size 100 x 625.


One small point: On average, one of every 2^32 32-bit integers produced as above will equal exactly 2^32, and the rand("state",vector) operation will change that rare value to 0. That wouldn't bother me, but if you want it to be a little more precise, you can do this to produce a matrix of N seed vectors:

stored_seeds = floor( [ rand( N, 624 ) * 2^32 , rand( N, 1 ) * 624 + 1 ] );

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]