Remove a bad use of tv_nsec.

This commit is contained in:
Jason S. Ninneman 2017-05-23 23:46:20 -07:00 committed by Eric S. Raymond
parent 5598b7a178
commit 060601da2f

4
misc.c
View file

@ -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;
} }