[Top][All Lists]

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

Re: [Help-gsl] Random number generators and Pthreads

From: Martin Jansche
Subject: Re: [Help-gsl] Random number generators and Pthreads
Date: Wed, 15 Nov 2006 01:28:30 -0500

On 11/14/06, Joseph Wakeling <address@hidden> wrote:

I usually take the present time as the seed, unless I specifically want
to enter one by hand: could I just take several times?  (I admit that's
probably not a good idea on a system where taking the time takes all of
a fraction of a second:-).

View the problem like this: you need a pool of k random words for your
k threads. For debugging purposes, it makes sense if you can
initialize that pool to a fixed set of values. For actual simulation
runs (don't do this for cryptography), you could initialize the pool
in one of the ways described earlier, or you could read 4*k (or 8*k)
random bytes from /dev/random or /dev/urandom if you have it.  As you
point out yourself, reading the system time k times in quick
succession is not such a good idea.

Depending on your OS (Linux, FreeBSD, Solaris, ...) and hardware, you
may have hardware and/or software support for entropy pools. For
example, I have access to a machine that has /dev/hwrng and has rngd
running to read it and replenish /dev/random.

-- mj

reply via email to

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