Take srand()/rand() out of the initialization chain...

...they're not guatanteed to produce consistent across platforms or
libc versions.
This commit is contained in:
Eric S. Raymond 2017-05-24 11:57:53 -04:00 committed by NHOrus
parent 9ef91255bc
commit bd64a4ceda

3
misc.c
View file

@ -761,8 +761,7 @@ long TSTBIT;
void set_seed(long seedval) void set_seed(long seedval)
{ {
srand(seedval); lcgstate.x = (unsigned long) seedval % lcgstate.m;
lcgstate.x = (unsigned long) rand() % lcgstate.m;
} }
unsigned long get_next_lcg_value(void) unsigned long get_next_lcg_value(void)