A random number generator. More...
#include <random_number_generator.hpp>
Public Member Functions | |
T | gaussian (const T &std, const T &mu=0) |
RandomNumberGenerator () | |
RandomNumberGenerator (const unsigned int randSeed) | |
T | uniform () |
T | uniform (const T &range) |
Static Private Member Functions | |
static void | seed () |
Seed the system random number generator. More... | |
A random number generator.
Definition at line 47 of file random_number_generator.hpp.
|
inline |
Definition at line 58 of file random_number_generator.hpp.
|
inline |
Definition at line 63 of file random_number_generator.hpp.
|
inline |
Definition at line 78 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 125 of file random_number_generator.hpp.
|
inline |
Definition at line 73 of file random_number_generator.hpp.
|
inline |
Definition at line 68 of file random_number_generator.hpp.