libfbm
0.3
Simulation of multi-dimensional stationary Gaussian processes and fractional Brownian motion.
|
Seed generator for random number generators. More...
#include <libfbm.hpp>
Public Member Functions | |
Seeder (const char *path) | |
Construct the Seeder. | |
~Seeder () | |
void | seed (uint32_t index) |
size_t | size () const |
operator const unsigned char * () const |
Seed generator for random number generators.
The Mersenne twister has a known weakness, that is with a small integer seed the first generated values are not very random. That is it takes a while for the generator to "work in". To get over this one can use a larger seed. This class generates such seeds from an integer index and a datafile containing random bits. On Unix one can easily generate such a seed pool file by executing:
dd if=/dev/urandom of=seedpool.dat bs=1024 count=1024
The seeds generated are 256 bytes long and contain blocks from the seed pool xor-ed with the given index. I'm not a specialist in random number generation, so I hope this is adequate.
Definition at line 388 of file libfbm.hpp.
libfbm::Seeder::Seeder | ( | const char * | path | ) |
Construct the Seeder.
The program aborts if the path cannot be opened or seed pool is too small (4kB).
libfbm::Seeder::~Seeder | ( | ) |
|
inline |
Definition at line 399 of file libfbm.hpp.
void libfbm::Seeder::seed | ( | uint32_t | index | ) |
|
inline |
Definition at line 398 of file libfbm.hpp.