On 09/27/2014 07:42 AM, Eric Smoll wrote:
Further comments are always welcome if anyone has any.
Hi Eric,

When I want non-deterministic behaviour I typically use /dev/urandom to obtain a seed. I've pasted the code below in case you're interested.

unsigned char ulongsize=sizeof(unsigned long);
char* buffer=new char[ulongsize];
std::ifstream is("/dev/urandom", std::ios::binary);
is.read(buffer,ulongsize);
is.close();
unsigned long s=0;
memcpy(&s, buffer, ulongsize);
delete[] buffer;
rng->seed(s);
return s;

where 'rng' is a gsl_rng pointer.

Cheers,

--
Peter Johansson


Reply via email to