|
Boost Users : |
Subject: Re: [Boost-users] Boost.Random Generator ignores seed
From: Juan Antonio Farré Basurte (jafb_at_[hidden])
Date: 2010-11-13 18:36:39
On Sun 14/11/10 00:04 , alfC alfredo.correa_at_[hidden] sent:
On Nov 13, 2:09 pm, Juan Antonio Farré Basurte
wrote:
> Â Hello,
>
> Â I'm using mt19937 random number generator, belonging to Boost.Random
> library, and it looks to ignore my call to seed.
> Â I show relevant code.
>
> Â static mt19937 gen;
> Â static MiniUni cien(1, 100);
> Â static variate_generator d100(gen, cien);
>
> Â .....
>
> Â int main() {
> Â Â Â Â {
> Â Â Â Â Â Â Â struct timeval time;
> Â Â Â Â Â Â Â gettimeofday(
> Â Â Â Â Â Â Â gen.seed(time.tv_usec);
> Â Â Â Â }
>
> Â ....
>
> Â And it generates the same sequence over and over. I've double-checked
> that time.tv_usec really changes.
> Â Any help would be appreciated.
> Â Thanks,
Try with a negative seed.
gen.seed( - time.tv_usec);
-- Alfredo
Mmmm... I'm afraid it didn't work...
_______________________________________________
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