Boost logo

Boost Users :

Subject: [Boost-users] Boost.Random Generator ignores seed
From: Juan Antonio Farré Basurte (jafb_at_[hidden])
Date: 2010-11-13 17:09:25


 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,

 Juan
  



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