This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RN generators Seed


On Tue, 26 Aug 2003, Maura Edeweiss Monville wrote:

> I'm currently using a RNG from the GNU Scietific Library in my simulation
> I need to rerun my simulation many times with different seeds.
> A friend of mine states the following:
> "You can use the final random seed of a run as the starting random seed of
> the next run (as you probably know, the random generators usually start
> with a seed and then modify it in the process of generating random
> numbers, so essentially the seed becomes a random number itself)"
> I wonder how the final seed value can be obtained when using GSL Random  
> Number Generators .... I only found the possibility to read and save the 
> RNG "status". I do not know the relation between the RNG "status" and the
> RNG "seed" ...     Can anyone help in this regards ?

This still leaves you with several problems -- generating the FIRST seed
to start your computation(s) and the possibility of preserving any
residual correlations (however weak) between one run and the next.
Similar objections are often raised against the use of the clock as a
starting seed -- in PRINCIPLE a rng started with two distinct seeds
produces random sequences that are not correlated, but in practice they
may well do so.  A better way (in my opinion) to seed your rng is to use
the built in entropy based rng, /dev/random.

I actually have built a gsl-compatible call wrapper for /dev/random just
so I could test it in the context of testing other gsl random number
routines and use it exclusively to seed rng's.  Given the fairly trivial
wrapper, /dev/random could be added directly to the existing gsl library
easily enough, perhaps with a test to see if /dev/random exists before
actually registering the method (it does in all modern linuces but I'm
not sure about all OS's on which gsl runs:-).

Alternatively the direct utilization code is trivial -- open the "file"
/dev/random, read out a seed's worth of data, close it, you're done.  I
also have code for that if you like.

Note that /dev/random is slow as molasses (relying as it does on the
gradual accumulation of entropy from many "random" hardware sources) and
so is not a good general purpose rng for most purposes.  It is excellent
for generating seeds though, as the uniform deviates are of high enough
quality themselves to pass all the diehard tests I've subjected them to
so far (which is still not all of them, but they aren't egregiously
bit-correlated at any rate).

If there is any interest in the gsl-compatible call wrapper for
/dev/random, the code to just open and read it, or putting /dev/random
into the gsl rng interface directly on systems where it exists, let me
know.

    rgb

> 
> Thank you
> Maura
> 

Robert G. Brown	                       http://www.phy.duke.edu/~rgb/
Duke University Dept. of Physics, Box 90305
Durham, N.C. 27708-0305
Phone: 1-919-660-2567  Fax: 919-660-2525     email:rgb@phy.duke.edu




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]