23 Jul
2004
23 Jul
'04
9:11 a.m.
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