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:
parent
c703bd78d9
commit
44e7ddc2ed
1 changed files with 1 additions and 2 deletions
3
misc.c
3
misc.c
|
@ -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)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue