Boost logo

Boost Users :

From: Hossein Haeri (powerprogman_at_[hidden])
Date: 2004-12-25 06:27:06


Paul (D),

> Your question was "how do I obtain a good random
> seed". If you need high
> quality randomness that is hard to predict, you need
> a source of entropy,
> that is, a "real" random number generator. On Linux
> such an entropy source
> is available as the /dev/urandom device, which you
> can read as an ordinary
> file. You can pass a boost::random_device to the
> constructor of your engine
> so it can seed itself from /dev/urandom.
>
> On Windows there is no /dev/urandom, but you can
> generate a high-quality
> random seed with CryptGenRandom. This function uses
> a number of essentially
> random values in the Windows kernel as an entropy
> source.

To be clear enough, I'm using Dev-C++ under windows.
AFAIK, it uses GCC (3.3.1) and does some sort of
simulation. What then? (Please :D)

> Of course if time(0) meets your needs, go for it.
> :-)

Hmmm... Not sure. Let me test it. And a question about
portability. Is <time.h> portable in C++?

TIA,
--Hossein

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net