Reference¶
-
template<class
UIntType
, std::size_tWordSize
, std::size_tp
>
classdcmt
::
dcmt_param
¶ Set of parameters for Mersenne Twister pseudo-random number generators.
- Template Parameters
UIntType
: unsigned integral type for generatorsWordSize
: word size for pseudo-random numbersp
: Mersenne prime exponent
Public Functions
-
dcmt_param
(result_type id = default_id, result_type seed = default_seed)¶ Searches for a set of parameters for pseudo-random number generators.
- Parameters
id
: to generate the characteristic polynomial. Must be <= 65535seed
: random seed to generate the characteristic polynomial
Public Static Attributes
-
constexpr std::size_t
word_size
= WordSize¶ Word size that determines the range of generated numbers.
-
constexpr result_type
default_id
= 0¶ Default id to search for the characteristic polynomial.
-
constexpr result_type
default_seed
= 4172¶ Default random seed to search for the characteristic polynomial.
-
template<class
UIntType
, std::size_tWordSize
, std::size_tp
>
classdcmt
::
dcmt_engine
¶ Mersenne Twister pseudo-random number generator engine.
- Template Parameters
UIntType
: unsigned integral type for the engineWordSize
: word size for the generated numbersp
: Mersenne prime exponent
Public Types
-
using
param_type
= dcmt_param<UIntType, WordSize, p>¶ Parameter type for the engine.
Public Functions
-
dcmt_engine
(result_type seed = default_seed)¶ Constructs the engine.
- Parameters
seed
: random seed
-
dcmt_engine
(const param_type ¶m, result_type seed = default_seed)¶ Constructs the engine.
- Parameters
param
: set of parametersseed
: random seed
-
dcmt_engine
(param_type &¶m, result_type seed = default_seed)¶ Constructs the engine.
- Parameters
param
: set of parametersseed
: random seed
-
void
seed
(result_type value = default_seed)¶ Reinitializes the engine by a new seed value.
- Parameters
value
: random seed
-
result_type
operator()
()¶ Returns the next pseudo-random number.
- Return
generated value
-
void
discard
(unsigned long long z)¶ Advances the internal state.
- Parameters
z
: number of advances
Public Static Functions
-
constexpr result_type
min
()¶ Returns the minimum value potentially generated by the engine, which is 0.
- Return
minimum value
-
constexpr result_type
max
()¶ Returns the maximum value potentially generated by the engine.
- Return
maximum value
Public Static Attributes
-
constexpr std::size_t
word_size
= WordSize¶ Word size that determines the range of numbers generated by the engine.
-
constexpr result_type
default_seed
= 3241¶ Default random seed.
Friends
-
friend bool
operator==
(const dcmt_engine &a, const dcmt_engine &b)¶ Compares two engines.
- Return
true
if the engines are equivalent including their internal states,false
otherwise- Parameters
a
: first engineb
: second engine
-
friend bool
operator!=
(const dcmt_engine &a, const dcmt_engine &b)¶ Compares two engines.
- Return
true
if the engines are not equivalent including their internal states,false
otherwise- Parameters
a
: first engineb
: second engine
-
using
dcmt
::
dcmt521
= dcmt_engine<std::uint_fast32_t, 32, 521>¶ 32-bit Mersenne Twister pseudo-random number generator engine with a period 2^521-1.