diff options
author | don bright <hugh.m.bright@gmail.com> | 2013-01-06 17:06:55 (GMT) |
---|---|---|
committer | don bright <hugh.m.bright@gmail.com> | 2013-01-06 17:06:55 (GMT) |
commit | 3825a7249944daa7765ebbdf836557c5032b2836 (patch) | |
tree | 48234386a7a7b1024a29961cfdfd217d6175c916 /src/func.cc | |
parent | 8aa349b15f65dd5106d182decd26c1027dcb7b7a (diff) |
clarify that its not nondeterministic, we are supporting older systems
where the C++/boost random_device stuff doesn't work.
boost random_device in particular has a lot of issues with old versions
not working, with -lboost_random not being installed by default, etc,
that complicate the build too much.
Diffstat (limited to 'src/func.cc')
-rw-r--r-- | src/func.cc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/func.cc b/src/func.cc index d32b382..ee269d0 100644 --- a/src/func.cc +++ b/src/func.cc @@ -34,6 +34,14 @@ #include <algorithm> #include "stl-utils.h" #include "printutils.h" + +/* + Random numbers + + Newer versions of boost/C++ include a non-deterministic random_device and + auto/bind()s for random function objects, but we are supporting older systems. +*/ + #include <boost/random/mersenne_twister.hpp> #include <boost/random/uniform_real_distribution.hpp> @@ -47,9 +55,7 @@ int process_id = getpid(); #endif boost::random::mt19937 deterministic_rng; -// 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 ); +boost::random::mt19937 lessdeterministic_rng( std::time(0) + process_id ); AbstractFunction::~AbstractFunction() { @@ -177,7 +183,7 @@ Value builtin_rands(const Context *, const std::vector<std::string>&, const std: if ( deterministic ) { vec.push_back( Value( distributor( deterministic_rng ) ) ); } else { - vec.push_back( Value( distributor( nondeterministic_rng ) ) ); + vec.push_back( Value( distributor( lessdeterministic_rng ) ) ); } } |