From 3825a7249944daa7765ebbdf836557c5032b2836 Mon Sep 17 00:00:00 2001 From: don bright Date: Sun, 6 Jan 2013 11:06:55 -0600 Subject: [PATCH] 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. --- src/func.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/func.cc b/src/func.cc index d32b3823..ee269d04 100644 --- a/src/func.cc +++ b/src/func.cc @@ -34,6 +34,14 @@ #include #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 #include @@ -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&, 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 ) ) ); } }