A random number generator. More...
#include <random_number_generator.hpp>
Public Member Functions | |
T | gaussian (const T &std, const T &mu=0) |
RandomNumberGenerator (const unsigned int randSeed) | |
RandomNumberGenerator () | |
T | uniform (const T &range) |
T | uniform () |
Static Private Member Functions | |
static void | seed () |
Seed the system random number generator. More... | |
A random number generator.
Definition at line 41 of file random_number_generator.hpp.
|
inline |
Definition at line 44 of file random_number_generator.hpp.
|
inline |
Definition at line 49 of file random_number_generator.hpp.
|
inline |
Definition at line 64 of file random_number_generator.hpp.
|
inlinestaticprivate |
Seed the system random number generator.
Here we create a seed by hashing from three independent sources. This is a more robust way to get a reliable seed that allows you to get the typically para-optimal traits
1) fine grained (e.g. you want to call srand two times in a very short interval) 2) low chance of collisions over a long period
It also avoids having to use esoteric linux functions lick clock_gettime that aren't available on all platforms.
References:
-h ttp://stackoverflow.com/questions/322938/recommended-way-to-initialize-srand
Definition at line 111 of file random_number_generator.hpp.
|
inline |
Definition at line 54 of file random_number_generator.hpp.
|
inline |
Definition at line 59 of file random_number_generator.hpp.