From 8aa349b15f65dd5106d182decd26c1027dcb7b7a Mon Sep 17 00:00:00 2001 From: don bright Date: Sun, 6 Jan 2013 17:35:31 +0100 Subject: also use process ID to seed pseudo random number generator diff --git a/src/func.cc b/src/func.cc index 0f9329d..d32b382 100644 --- a/src/func.cc +++ b/src/func.cc @@ -37,10 +37,19 @@ #include #include +#ifdef __WIN32__ +#include +int process_id = _getpid(); +#else +#include +#include +int process_id = getpid(); +#endif + boost::random::mt19937 deterministic_rng; -// not technically non-deterministic, but boost::random::random_device has -// non-header library and/or version issues that would complicate the build -boost::random::mt19937 nondeterministic_rng( std::time(0) ); +// this is technically not non-deterministic, but boost::random::random_device +// has non-header library and/or version issues that would complicate the build +boost::random::mt19937 nondeterministic_rng( std::time(0) + process_id ); AbstractFunction::~AbstractFunction() { -- cgit v0.10.1