44 class RNG :
public std::mt19937
48 RNG (std::mt19937::result_type seed) :
std::mt19937 (seed) { }
50 template <
typename ValueType>
class Uniform;
51 template <
typename ValueType>
class Normal;
52 template <
typename ValueType>
class Integer;
55 static std::mutex mutex;
56 std::lock_guard<std::mutex> lock (mutex);
57 static std::mt19937::result_type current_seed = get_seed_private();
58 return current_seed++;
62 static std::mt19937::result_type get_seed_private () {
78 const char* from_env = getenv (
"MRTRIX_RNG_SEED");
80 return to<std::mt19937::result_type> (from_env);
82 std::random_device rd;
90 template <
typename ValueType>
97 std::uniform_real_distribution<ValueType>
dist;
101 template <
typename ValueType>
106 std::normal_distribution<ValueType>
dist;
110 template <
typename ValueType>
116 std::uniform_int_distribution<ValueType>
dist;
Integer(const ValueType max)
std::uniform_int_distribution< ValueType > dist
std::normal_distribution< ValueType > dist
static std::mt19937::result_type get_seed()
RNG(std::mt19937::result_type seed)