Remove a bad use of tv_nsec.
This commit is contained in:
parent
5598b7a178
commit
060601da2f
1 changed files with 1 additions and 3 deletions
4
misc.c
4
misc.c
|
@ -761,9 +761,7 @@ long TSTBIT;
|
||||||
void set_seed_from_time(void)
|
void set_seed_from_time(void)
|
||||||
{
|
{
|
||||||
/* Use the current system time to get seed the ISO rand() function, from which we get a seed for the LCG. */
|
/* Use the current system time to get seed the ISO rand() function, from which we get a seed for the LCG. */
|
||||||
struct timespec ts;
|
srand(time(NULL));
|
||||||
clock_gettime(CLOCK_REALTIME, &ts);
|
|
||||||
srand(ts.tv_nsec);
|
|
||||||
lcgstate.x = (unsigned long) rand() % lcgstate.m;
|
lcgstate.x = (unsigned long) rand() % lcgstate.m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue