dcmt-cpp
1.0.0
|
Mersenne Twister pseudo-random number generator engine. More...
#include <dcmt.h>
Public Types | |
using | param_type = dcmt_param< UIntType, WordSize, p > |
Parameter type for the engine. More... | |
using | result_type = UIntType |
Integral type generated by the engine. More... | |
Public Member Functions | |
dcmt_engine (result_type seed=default_seed) | |
Constructs the engine. More... | |
dcmt_engine (const param_type ¶m, result_type seed=default_seed) | |
Constructs the engine. More... | |
dcmt_engine (param_type &¶m, result_type seed=default_seed) | |
Constructs the engine. More... | |
void | seed (result_type value=default_seed) |
Reinitializes the engine by a new seed value. More... | |
result_type | operator() () |
Returns the next pseudo-random number. More... | |
void | discard (unsigned long long z) |
Advances the internal state. More... | |
Static Public Member Functions | |
static constexpr result_type | min () |
Returns the minimum value potentially generated by the engine, which is 0. More... | |
static constexpr result_type | max () |
Returns the maximum value potentially generated by the engine. More... | |
Static Public Attributes | |
static constexpr std::size_t | word_size = WordSize |
Word size that determines the range of numbers generated by the engine. More... | |
static constexpr std::size_t | prime_exponent = p |
Mersenne prime exponent. More... | |
static constexpr result_type | default_seed = 3241 |
Default random seed. More... | |
Friends | |
bool | operator== (const dcmt_engine &a, const dcmt_engine &b) |
Compares two engines. More... | |
bool | operator!= (const dcmt_engine &a, const dcmt_engine &b) |
Compares two engines. More... | |
template<class CharT , class Traits > | |
std::basic_ostream< CharT, Traits > & | operator<< (std::basic_ostream< CharT, Traits > &os, const dcmt_engine &e) |
Serializes the state of the given engine into a stream. More... | |
template<class CharT , class Traits > | |
std::basic_istream< CharT, Traits > & | operator>> (std::basic_istream< CharT, Traits > &is, dcmt_engine &e) |
Deserializes the state of the given engine from a stream. More... | |
Mersenne Twister pseudo-random number generator engine.
UIntType | unsigned integral type for the engine |
WordSize | word size for the generated numbers |
p | Mersenne prime exponent |
using dcmt::dcmt_engine< UIntType, WordSize, p >::param_type = dcmt_param<UIntType, WordSize, p> |
Parameter type for the engine.
using dcmt::dcmt_engine< UIntType, WordSize, p >::result_type = UIntType |
Integral type generated by the engine.
|
inlineexplicit |
Constructs the engine.
seed | random seed |
|
inlineexplicit |
Constructs the engine.
param | set of parameters |
seed | random seed |
|
inlineexplicit |
Constructs the engine.
param | set of parameters |
seed | random seed |
|
inline |
Advances the internal state.
z | number of advances |
|
inlinestatic |
Returns the maximum value potentially generated by the engine.
|
inlinestatic |
Returns the minimum value potentially generated by the engine, which is 0.
|
inline |
Returns the next pseudo-random number.
|
inline |
Reinitializes the engine by a new seed value.
value | random seed |
|
friend |
Compares two engines.
a | first engine |
b | second engine |
true
if the engines are not equivalent including their internal states, false
otherwise
|
friend |
Serializes the state of the given engine into a stream.
os | output stream |
e | engine to be serialized |
os
|
friend |
Compares two engines.
a | first engine |
b | second engine |
true
if the engines are equivalent including their internal states, false
otherwise
|
friend |
Deserializes the state of the given engine from a stream.
is | input stream |
e | engine to be deserialized |
is
|
static |
Default random seed.
|
static |
Mersenne prime exponent.
|
static |
Word size that determines the range of numbers generated by the engine.