Boost logo

Boost Users :

Subject: Re: [Boost-users] [Random] Good Truly-Random Seed
From: Andy Tompkins (atompkins_at_[hidden])
Date: 2010-04-23 12:49:47


On Wed, 21 Apr 2010 20:47 +0300, "Marius" <letto2_at_[hidden]> wrote:
> On Wednesday 21 April 2010 16:31:21 Mathias Gaunard wrote:
> > > May I please know what do you guys use as you "good truly-random seed"?
> >
> > I use /dev/random
>
> May I suggest that boost should have a cross-platform function to so
> this.
> time(NULL) is not random.
>
> A good hack would be xoring many "random" numbers that you can get:
> -time(NULL)
> -pid
> -the values fo uninitialised variables
> whatever you can think of
>
>

boost::uuids::detail::seed_rng found in boost\uuid\seed_rng.hpp provides
a implementation of this.

one can also call
boost::uuids::detail::seed(UniformRandomNumberGenerator)

Regards,
Andy.


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