|
Boost Users : |
From: Graham Reitz (graham.cpp_at_[hidden])
Date: 2007-10-23 17:42:22
Thanks for the reply Mike. I am still stumped. Any ideas on how I
can tell what type the "DataType" is?
Graham
On 10/23/07, Michael Linck <mgl_at_[hidden]> wrote:
> Looks like you seed it by converting your time stamp to whatever
> "DataType" you're trying to get back and using it as an arg to seed:
> "
> lass random::mersenne_twister
> {
> public:
> typedef DataType result_type;
> .
> .
> .
> void seed();
> void seed(DataType value);
> " -- http://www.boost.org/libs/random/random-generators.html#mersenne_twister
>
> Or you can take the - possibly more complicated - route of trying to figure out how to use the Generator template.
>
> Hope that helps,
>
> mike
>
> On Tue, 2007-10-23 at 12:00 -0500, Graham Reitz wrote:
> > I am little confused on how to see a random generator.
> >
> > What am I missing?
> >
> > // Grab the seed
> > HighResTimer::Time time_secs = high_res_timer.getTime();
> >
> > // Go ahead and truncate, it's just a seed
> > boost::int32_t time = static_cast<boost::int32_t>(time_secs * 100000);
> >
> > // produces randomness out of thin air
> > // see pseudo-random number generators
> > boost::mt19937 rng;
> > rng.seed(); // How do you seed this with the time?
> >
> > // distribution that maps to 0..1
> > // see random number distributions
> > boost::uniform_real<> zero_to_one(0,1);
> >
> > // glues randomness with mapping
> > boost::variate_generator<boost::mt19937&, boost::uniform_real<> >
> > be_random zero_to_one);
> > _______________________________________________
> > Boost-users mailing list
> > Boost-users_at_[hidden]
> > http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
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