Episys/fixing cqi problem
This commit is contained in:
committed by
Michael Cook
parent
24f82c5d6f
commit
79df38d515
@@ -49,9 +49,20 @@ void set_taus_seed(unsigned int seed_init)
|
||||
unsigned long result = 0;
|
||||
|
||||
if (seed_init == 0) {
|
||||
s0 = (unsigned int)time(NULL);
|
||||
s1 = (unsigned int)time(NULL);
|
||||
s2 = (unsigned int)time(NULL);
|
||||
unsigned int data[3];
|
||||
int fd = open("/dev/urandom", O_RDONLY);
|
||||
if (fd == -1)
|
||||
{
|
||||
abort();
|
||||
}
|
||||
if (read(fd, data, sizeof(data)) != sizeof(data))
|
||||
{
|
||||
abort();
|
||||
}
|
||||
close(fd);
|
||||
s0 = data[0];
|
||||
s1 = data[1];
|
||||
s2 = data[2];
|
||||
} else {
|
||||
/* Use reentrant version of rand48 to ensure that no conflicts with other generators occur */
|
||||
srand48_r((long int)seed_init, &buffer);
|
||||
|
||||
Reference in New Issue
Block a user