On Monday, 24. January 2011 22:11:55 Steven Watanabe wrote:
AMDG
On 1/24/2011 12:57 PM, Lasse Kliemann wrote:
I use /dev/urandom for this, like so (code fragments): FILE *dev_urandom; uint32_t seed; if((dev_urandom = fopen("/dev/urandom", "r")) == NULL) throw /* error */ if(fread(&seed, sizeof(seed), 1, dev_urandom) == 0) throw /* error */ if(fclose(dev_urandom) != 0) throw /* error */ boost::mt19937 gen(seed);
But maybe there are even better ways.
boost::random_device seed_gen; boost::mt19937 gen(seed_gen());
should have the same effect and is more portable.
Nice. Thank you.
In Christ, Steven Watanabe _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Best, Cedric