#include <random_generator.h>
Public Member Functions | |
unsigned int | generate (unsigned int) |
double | generate01 () |
Returns a random number in the [0,1) real interval using the improved Marsenne-Twister. | |
double | generate01closed () |
Returns a random number in the [0,1] real interval using the improved Marsenne-Twister. | |
double | generate01open () |
Generates a random number in the (0,1) real interval using the improved Marsenne-Twister. | |
void | initialize (unsigned int seed) |
(Re-)initialize with the given seed. | |
void | initializeByArray (unsigned int init_key[], int key_length) |
MarsenneTwisterRNG () | |
virtual | ~MarsenneTwisterRNG () |
Private Attributes | |
unsigned int | mt [N] |
int | mti |
Static Private Attributes | |
static const unsigned int | LOWER_MASK = 0x7fffffffu |
static const int | M = 397 |
static const unsigned int | MATRIX_A = 0x9908b0dfu |
static const int | N = 624 |
static const unsigned int | UPPER_MASK = 0x80000000u |
The second one is an improved Marsenne-Twister algorithm (MT19937) Coded by Takuji Nishimura and Makoto Matsumoto (see copyright note below) and successively modified to be a C++ class by Daniel Dunbar.
References for improved Marsenne-Twister:
http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
Definition at line 173 of file random_generator.h.
vcg::math::MarsenneTwisterRNG::MarsenneTwisterRNG | ( | ) | [inline] |
Definition at line 196 of file random_generator.h.
virtual vcg::math::MarsenneTwisterRNG::~MarsenneTwisterRNG | ( | ) | [inline, virtual] |
Definition at line 201 of file random_generator.h.
unsigned int vcg::math::MarsenneTwisterRNG::generate | ( | unsigned int | ) | [inline, virtual] |
Return a random number in the [0,0xffffffff] interval using the improved Marsenne Twister algorithm.
NOTE: Limit is not considered, the interval is fixed.
Implements vcg::math::RandomGenerator.
Definition at line 271 of file random_generator.h.
double vcg::math::MarsenneTwisterRNG::generate01 | ( | ) | [inline, virtual] |
Returns a random number in the [0,1) real interval using the improved Marsenne-Twister.
Implements vcg::math::RandomGenerator.
Definition at line 317 of file random_generator.h.
double vcg::math::MarsenneTwisterRNG::generate01closed | ( | ) | [inline, virtual] |
Returns a random number in the [0,1] real interval using the improved Marsenne-Twister.
Implements vcg::math::RandomGenerator.
Definition at line 311 of file random_generator.h.
double vcg::math::MarsenneTwisterRNG::generate01open | ( | ) | [inline, virtual] |
Generates a random number in the (0,1) real interval using the improved Marsenne-Twister.
Implements vcg::math::RandomGenerator.
Definition at line 323 of file random_generator.h.
void vcg::math::MarsenneTwisterRNG::initialize | ( | unsigned int | seed | ) | [inline, virtual] |
(Re-)initialize with the given seed.
Implements vcg::math::RandomGenerator.
Definition at line 209 of file random_generator.h.
void vcg::math::MarsenneTwisterRNG::initializeByArray | ( | unsigned int | init_key[], | |
int | key_length | |||
) | [inline] |
Initialize by an array with array-length.
init_key is the array for initializing keys key_length is its length
Definition at line 230 of file random_generator.h.
const unsigned int vcg::math::MarsenneTwisterRNG::LOWER_MASK = 0x7fffffffu [static, private] |
Definition at line 183 of file random_generator.h.
const int vcg::math::MarsenneTwisterRNG::M = 397 [static, private] |
Definition at line 180 of file random_generator.h.
const unsigned int vcg::math::MarsenneTwisterRNG::MATRIX_A = 0x9908b0dfu [static, private] |
Definition at line 181 of file random_generator.h.
unsigned int vcg::math::MarsenneTwisterRNG::mt[N] [private] |
Definition at line 189 of file random_generator.h.
int vcg::math::MarsenneTwisterRNG::mti [private] |
Definition at line 190 of file random_generator.h.
const int vcg::math::MarsenneTwisterRNG::N = 624 [static, private] |
Definition at line 179 of file random_generator.h.
const unsigned int vcg::math::MarsenneTwisterRNG::UPPER_MASK = 0x80000000u [static, private] |
Definition at line 182 of file random_generator.h.