This repository has been archived on 2026-03-28. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
eodev/eo/src/utils/eoRNG.cpp
evomarc f4d2630516 Corrected a problem in eoEsChromInit (it refused plain eoReal) + some
other minor modications (e.g. a dir in make_checkpoint where ALL file
will go).
2001-05-03 17:20:27 +00:00

22 lines
455 B
C++

#include <ctime>
#include "eoRNG.h"
#include <sys/time.h>
/** this function retunrs a "truly random" seed for RNG
* Replaces the call to time(0) that seems to be non-portable???
*/
uint32 random_seed()
{
struct timeval tval;
struct timezone tzp;
gettimeofday (&tval, &tzp); // milliseconds since midnight January 1, 1970.
return uint32(tval.tv_usec);
}
namespace eo
{
/// The Global random number generator.
eoRng rng(random_seed());
}