Library of Assembled Shared Sources
|
implemenents a mersenne twister MT19937. More...
#include <random.h>
Public Types | |
using | result_type = num::Tuint32 |
type of return value. | |
typedef num::Tuint32 | TValue |
type of return value. | |
Public Member Functions | |
RandomMT19937 () | |
default constructor. | |
RandomMT19937 (result_type seed) | |
construct with seed. | |
template<typename ForwardIterator> | |
RandomMT19937 (ForwardIterator first, ForwardIterator last) | |
construct by a range of initializing keys Requirements: | |
void | seed (result_type seed) |
initializes with a seed. | |
template<typename ForwardIterator> | |
void | seed (ForwardIterator first, ForwardIterator last) |
initialize by a range of initializing keys Requirements: | |
result_type | operator() () |
draw a random number | |
result_type | operator() (result_type supremum) |
draw a random number remapped to range [0, supremum) | |
Static Public Member Functions | |
static constexpr result_type | min () |
minimum return value. | |
static constexpr result_type | max () |
maximum return value. | |
implemenents a mersenne twister MT19937.
RandomMT19937 is the LASS implementation of the Mersenne twister. Mersenne Twister(MT) is a pseudorandom number generator developped by Makoto Matsumoto and Takuji Nishimura (alphabetical order) during 1996-1997. MT has the following merits:
M. Matsumoto and T. Nishimura, "Mersenne Twister: A 623-dimensionally equidistributed uniform pseudorandom number generator", ACM Trans. on Modeling and Computer Simulation Vol. 8, No. 1, January pp.3-30 1998, http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
Our version is implemented after the MT19937 standard code of 2002/1/26 (mt19937ar.c)
typedef num::Tuint32 lass::num::RandomMT19937::TValue |
lass::num::RandomMT19937::RandomMT19937 | ( | ) |
default constructor.
will seed with default value on first use.
Definition at line 104 of file random.cpp.
lass::num::RandomMT19937::RandomMT19937 | ( | ForwardIterator | first, |
ForwardIterator | last ) |
construct by a range of initializing keys Requirements:
Definition at line 141 of file random.inl.
References seed().
void lass::num::RandomMT19937::seed | ( | ForwardIterator | first, |
ForwardIterator | last ) |
initialize by a range of initializing keys Requirements:
Definition at line 155 of file random.inl.
References LASS_META_ASSERT, and seed().
|
inline |
draw a random number remapped to range [0, supremum)
Definition at line 207 of file random.inl.