|
| BOOST_STATIC_CONSTANT (std::size_t, word_size=w) |
|
| BOOST_STATIC_CONSTANT (std::size_t, state_size=n) |
|
| BOOST_STATIC_CONSTANT (std::size_t, shift_size=m) |
|
| BOOST_STATIC_CONSTANT (std::size_t, mask_bits=r) |
|
| BOOST_STATIC_CONSTANT (UIntType, xor_mask=a) |
|
| BOOST_STATIC_CONSTANT (std::size_t, tempering_u=u) |
|
| BOOST_STATIC_CONSTANT (UIntType, tempering_d=d) |
|
| BOOST_STATIC_CONSTANT (std::size_t, tempering_s=s) |
|
| BOOST_STATIC_CONSTANT (UIntType, tempering_b=b) |
|
| BOOST_STATIC_CONSTANT (std::size_t, tempering_t=t) |
|
| BOOST_STATIC_CONSTANT (UIntType, tempering_c=c) |
|
| BOOST_STATIC_CONSTANT (std::size_t, tempering_l=l) |
|
| BOOST_STATIC_CONSTANT (UIntType, initialization_multiplier=f) |
|
| BOOST_STATIC_CONSTANT (UIntType, default_seed=5489u) |
|
| BOOST_STATIC_CONSTANT (UIntType, parameter_a=a) |
|
| BOOST_STATIC_CONSTANT (std::size_t, output_u=u) |
|
| BOOST_STATIC_CONSTANT (std::size_t, output_s=s) |
|
| BOOST_STATIC_CONSTANT (UIntType, output_b=b) |
|
| BOOST_STATIC_CONSTANT (std::size_t, output_t=t) |
|
| BOOST_STATIC_CONSTANT (UIntType, output_c=c) |
|
| BOOST_STATIC_CONSTANT (std::size_t, output_l=l) |
|
| BOOST_STATIC_CONSTANT (bool, has_fixed_range=false) |
|
| mersenne_twister_engine () |
| Constructs a mersenne_twister_engine and calls seed() . More...
|
|
| BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR (mersenne_twister_engine, UIntType, value) |
| Constructs a mersenne_twister_engine and calls seed(value) . More...
|
|
template<class It > |
| mersenne_twister_engine (It &first, It last) |
|
| BOOST_RANDOM_DETAIL_SEED_SEQ_CONSTRUCTOR (mersenne_twister_engine, SeedSeq, seq) |
| Constructs a mersenne_twister_engine and calls seed(gen) . More...
|
|
void | seed () |
| Calls seed(default_seed) . More...
|
|
| BOOST_RANDOM_DETAIL_ARITHMETIC_SEED (mersenne_twister_engine, UIntType, value) |
| Sets the state x(0) to v mod 2w. More...
|
|
| BOOST_RANDOM_DETAIL_SEED_SEQ_SEED (mersenne_twister_engine, SeeqSeq, seq) |
| Seeds a mersenne_twister_engine using values produced by seq.generate(). More...
|
|
template<class It > |
void | seed (It &first, It last) |
| Sets the state of the generator using values from an iterator range. More...
|
|
result_type | operator() () |
| Produces the next value of the generator. More...
|
|
template<class Iter > |
void | generate (Iter first, Iter last) |
| Fills a range with random values. More...
|
|
void | discard (boost::uintmax_t z) |
| Advances the state of the generator by z steps. More...
|
|
|
template<class CharT , class Traits > |
std::basic_ostream< CharT,
Traits > & | operator<< (std::basic_ostream< CharT, Traits > &os, const mersenne_twister_engine &mt) |
| Writes a mersenne_twister_engine to a std::ostream . More...
|
|
template<class CharT , class Traits > |
std::basic_istream< CharT,
Traits > & | operator>> (std::basic_istream< CharT, Traits > &is, mersenne_twister_engine &mt) |
| Reads a mersenne_twister_engine from a std::istream . More...
|
|
bool | operator== (const mersenne_twister_engine &x_, const mersenne_twister_engine &y_) |
| Returns true if the two generators are in the same state, and will thus produce identical sequences. More...
|
|
bool | operator!= (const mersenne_twister_engine &x_, const mersenne_twister_engine &y_) |
| Returns true if the two generators are in different states. More...
|
|
template<class UIntType, std::size_t w, std::size_t n, std::size_t m, std::size_t r, UIntType a, std::size_t u, UIntType d, std::size_t s, UIntType b, std::size_t t, UIntType c, std::size_t l, UIntType f>
class boost::random::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >
Instantiations of class template mersenne_twister_engine model a .
It uses the algorithm described in
"Mersenne Twister: A 623-dimensionally equidistributed uniform
pseudo-random number generator", Makoto Matsumoto and Takuji Nishimura, ACM Transactions on Modeling and Computer Simulation: Special Issue on Uniform Random Number Generation, Vol. 8, No. 1, January 1998, pp. 3-30.
The boost variant has been implemented from scratch and does not derive from or use mt19937.c provided on the above WWW site. However, it was verified that both produce identical output.
The seeding from an integer was changed in April 2005 to address a weakness.
The quality of the generator crucially depends on the choice of the parameters. User code should employ one of the sensibly parameterized generators such as instead.
The generator requires considerable amounts of memory for the storage of its state array. For example, requires about 1408 bytes and requires about 2496 bytes.
template<class UIntType, std::size_t w, std::size_t n, std::size_t m, std::size_t r, UIntType a, std::size_t u, UIntType d, std::size_t s, UIntType b, std::size_t t, UIntType c, std::size_t l, UIntType f>
boost::random::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::mersenne_twister_engine |
( |
| ) |
|
|
inline |
Constructs a mersenne_twister_engine
and calls seed()
.
References boost::random::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::seed().
template<class UIntType, std::size_t w, std::size_t n, std::size_t m, std::size_t r, UIntType a, std::size_t u, UIntType d, std::size_t s, UIntType b, std::size_t t, UIntType c, std::size_t l, UIntType f>
template<class It >
boost::random::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::mersenne_twister_engine |
( |
It & |
first, |
|
|
It |
last |
|
) |
| |
|
inline |
References boost::random::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::seed().
template<class UIntType, std::size_t w, std::size_t n, std::size_t m, std::size_t r, UIntType a, std::size_t u, UIntType d, std::size_t s, UIntType b, std::size_t t, UIntType c, std::size_t l, UIntType f>
static result_type min boost::random::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::BOOST_PREVENT_MACRO_SUBSTITUTION |
( |
| ) |
|
|
inlinestatic |
Returns the smallest value that the generator can produce.
template<class UIntType, std::size_t w, std::size_t n, std::size_t m, std::size_t r, UIntType a, std::size_t u, UIntType d, std::size_t s, UIntType b, std::size_t t, UIntType c, std::size_t l, UIntType f>
static result_type max boost::random::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::BOOST_PREVENT_MACRO_SUBSTITUTION |
( |
| ) |
|
|
inlinestatic |
Returns the largest value that the generator can produce.
template<class UIntType, std::size_t w, std::size_t n, std::size_t m, std::size_t r, UIntType a, std::size_t u, UIntType d, std::size_t s, UIntType b, std::size_t t, UIntType c, std::size_t l, UIntType f>
boost::random::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR |
( |
mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f > |
, |
|
|
UIntType |
, |
|
|
value |
|
|
) |
| |
|
inline |
Constructs a mersenne_twister_engine
and calls seed(value)
.
References boost::random::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::seed(), and boost::program_options::value().
template<class UIntType, std::size_t w, std::size_t n, std::size_t m, std::size_t r, UIntType a, std::size_t u, UIntType d, std::size_t s, UIntType b, std::size_t t, UIntType c, std::size_t l, UIntType f>
boost::random::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::BOOST_RANDOM_DETAIL_ARITHMETIC_SEED |
( |
mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f > |
, |
|
|
UIntType |
, |
|
|
value |
|
|
) |
| |
|
inline |
template<class UIntType, std::size_t w, std::size_t n, std::size_t m, std::size_t r, UIntType a, std::size_t u, UIntType d, std::size_t s, UIntType b, std::size_t t, UIntType c, std::size_t l, UIntType f>
boost::random::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::BOOST_RANDOM_DETAIL_SEED_SEQ_CONSTRUCTOR |
( |
mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f > |
, |
|
|
SeedSeq |
, |
|
|
seq |
|
|
) |
| |
|
inline |
Constructs a mersenne_twister_engine and calls seed(gen)
.
The copy constructor will always be preferred over the templated constructor.
References boost::random::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::seed().
template<class UIntType, std::size_t w, std::size_t n, std::size_t m, std::size_t r, UIntType a, std::size_t u, UIntType d, std::size_t s, UIntType b, std::size_t t, UIntType c, std::size_t l, UIntType f>
void boost::random::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::discard |
( |
boost::uintmax_t |
z | ) |
|
|
inline |
Advances the state of the generator by z
steps.
Equivalent to
for(unsigned long long i = 0; i < z; ++i) {
gen();
}
template<class UIntType, std::size_t w, std::size_t n, std::size_t m, std::size_t r, UIntType a, std::size_t u, UIntType d, std::size_t s, UIntType b, std::size_t t, UIntType c, std::size_t l, UIntType f>
template<class Iter >
void boost::random::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::generate |
( |
Iter |
first, |
|
|
Iter |
last |
|
) |
| |
|
inline |
Fills a range with random values.
template<class UIntType , std::size_t w, std::size_t n, std::size_t m, std::size_t r, UIntType a, std::size_t u, UIntType d, std::size_t s, UIntType b, std::size_t t, UIntType c, std::size_t l, UIntType f>
mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::result_type boost::random::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::operator() |
( |
| ) |
|
|
inline |
template<class UIntType, std::size_t w, std::size_t n, std::size_t m, std::size_t r, UIntType a, std::size_t u, UIntType d, std::size_t s, UIntType b, std::size_t t, UIntType c, std::size_t l, UIntType f>
void boost::random::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::seed |
( |
| ) |
|
|
inline |
Calls seed(default_seed)
.
References boost::random::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::seed().
Referenced by boost::random::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR(), boost::random::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::BOOST_RANDOM_DETAIL_SEED_SEQ_CONSTRUCTOR(), boost::random::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::mersenne_twister_engine(), and boost::random::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::seed().
template<class UIntType, std::size_t w, std::size_t n, std::size_t m, std::size_t r, UIntType a, std::size_t u, UIntType d, std::size_t s, UIntType b, std::size_t t, UIntType c, std::size_t l, UIntType f>
template<class It >
void boost::random::mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f >::seed |
( |
It & |
first, |
|
|
It |
last |
|
) |
| |
|
inline |
template<class UIntType, std::size_t w, std::size_t n, std::size_t m, std::size_t r, UIntType a, std::size_t u, UIntType d, std::size_t s, UIntType b, std::size_t t, UIntType c, std::size_t l, UIntType f>
bool operator!= |
( |
const mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f > & |
x_, |
|
|
const mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f > & |
y_ |
|
) |
| |
|
friend |
Returns true if the two generators are in different states.
template<class UIntType, std::size_t w, std::size_t n, std::size_t m, std::size_t r, UIntType a, std::size_t u, UIntType d, std::size_t s, UIntType b, std::size_t t, UIntType c, std::size_t l, UIntType f>
template<class CharT , class Traits >
std::basic_ostream<CharT,Traits>& operator<< |
( |
std::basic_ostream< CharT, Traits > & |
os, |
|
|
const mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f > & |
mt |
|
) |
| |
|
friend |
template<class UIntType, std::size_t w, std::size_t n, std::size_t m, std::size_t r, UIntType a, std::size_t u, UIntType d, std::size_t s, UIntType b, std::size_t t, UIntType c, std::size_t l, UIntType f>
bool operator== |
( |
const mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f > & |
x_, |
|
|
const mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f > & |
y_ |
|
) |
| |
|
friend |
Returns true if the two generators are in the same state, and will thus produce identical sequences.
template<class UIntType, std::size_t w, std::size_t n, std::size_t m, std::size_t r, UIntType a, std::size_t u, UIntType d, std::size_t s, UIntType b, std::size_t t, UIntType c, std::size_t l, UIntType f>
template<class CharT , class Traits >
std::basic_istream<CharT,Traits>& operator>> |
( |
std::basic_istream< CharT, Traits > & |
is, |
|
|
mersenne_twister_engine< UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f > & |
mt |
|
) |
| |
|
friend |