Don't seed() mersenne_twister RNG with 0

Hi,
a seed(0) with a mersenne_twister (like mt11213b or mt19937) aborts on
some assertion (tested on boost 1.31).
boost/random/linear_congruential.hpp:61:
boost::random::linear_congruential

a seed(0) with a mersenne_twister (like mt11213b or mt19937) aborts on some assertion (tested on boost 1.31).
Same problem with minstd_rand, minstd_rand0, lagged_fibonacci (calls minstd_rand0.seed(x))and ecuyer1988 (calls linear_congruential.seed(x)). Solution used by glibc (glibc-2.3.2.ds1/glibc-2.3.2/stdlib/random_r.c) : /* We must make sure the seed is not 0. Take arbitrarily 1 in this case. */ if (seed == 0) seed = 1; PS: seed(0) is ok for rand48, kreutzer1986 and hellekalek1995. -- Benoît Sibaud
participants (1)
-
Benoît SIBAUD