Commit 92d5270a authored by Robert Schmidt's avatar Robert Schmidt

Use get_random_seed() in set_taus_seed(), used by taus()

parent 2ec0b4b8
......@@ -23,7 +23,7 @@
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
//#include "SIMULATION/TOOLS/sim.h"
#include "sim.h"
static unsigned int s0, s1, s2;
......@@ -52,20 +52,9 @@ void set_taus_seed(unsigned int seed_init)
unsigned long result = 0;
if (seed_init == 0) {
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];
s0 = (unsigned int) get_random_seed();
s1 = (unsigned int) get_random_seed();
s2 = (unsigned int) get_random_seed();
} else {
/* Use reentrant version of rand48 to ensure that no conflicts with other generators occur */
srand48_r((long int)seed_init, &buffer);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment