I just found out the hard way that srand(1) resets the PRNG of C(++) to the state before any call to srand (as defined in the reference). However,
srand(1)
srand
How glibc does it:
around line 181 of glibc/stdlib/random_r.c, inside function __srandom_r /* We must make sure the seed is not 0. Take arbitrarily 1 in this case. */ if (seed == 0) seed = 1;
around line 181 of glibc/stdlib/random_r.c, inside function __srandom_r
__srandom_r
/* We must make sure the seed is not 0. Take arbitrarily 1 in this case. */ if (seed == 0) seed = 1;
But that's just how glibc does it. It depends on the implementation of the C standard library.