SyTen
random.cpp File Reference

Implementation for file inc/util/random.h. More...

#include <mutex>
#include <iostream>
#include "inc/util/random.h"
#include "inc/util/threads.h"
+ Include dependency graph for random.cpp:

Namespaces

 syten
 Syten namespace.
 
 syten::Random
 The random number generation engine generation subsystem.
 

Functions

void syten::Random::disableReproducible ()
 Sets the global seed to zero, causing non-reproducible generation of random number engines by genEngine(). More...
 
Engine syten::Random::genEngine ()
 Returns a random number generation engine. More...
 
Result syten::Random::genValue ()
 Generates a single value from the internal LCG, mainly useful for debugging. More...
 
Result const & syten::Random::getSeed ()
 Returns the seed used by the internal LCG. More...
 
Result syten::Random::initReproducible (Result const seed_=0)
 Initialises the global generating random number engine. More...
 
bool syten::Random::isReproducible ()
 Returns true if the global seed is non-zero and no threading is used. More...
 

Variables

std::linear_congruential_engine< Result, 6364136223846793005ULL, 1442695040888963407ULL, 18446744073709551615ULL > syten::Random::engine {std::random_device()()}
 Engine used to generate seeds for genEngine() below. More...
 
std::mutex syten::Random::mtx_engine
 Mutex protecting genEngine (and engine) below if seed is non-zero. More...
 
Result syten::Random::seed {0}
 global seed, if zero, none was set and genEngine() is non-deterministic More...
 

Detailed Description

Implementation for file inc/util/random.h.