Reference¶
-
using
tinymt
::
tinymt32
= tinymt_engine<uint_fast32_t, 32, detail::tinymt32_default_param_mat1, detail::tinymt32_default_param_mat2, detail::tinymt32_default_param_tmat, false>¶ TinyMT32 generator engine with the parameter set specified in RFC 8682.
-
template<class
UIntType
, std::size_tWordSize
, UIntTypeMat1
, UIntTypeMat2
, UIntTypeTMat
, boolDoPeriodCertification
= true>
classtinymt
::
tinymt_engine
¶ Pseudo-random number generator engine based on the TinyMT algorithms.
- Note
Currently
WordSize
must be32
.- Note
When
Mat
,Mat2
andTMat
are all zero, the generator parameter set must be provided in initialization (“Dynamic Creation” (DC) mode).- Template Parameters
UIntType
: unsigned integral type generated by the engineWordSize
: word size for the generated numbersMat1
: parameter used in the linear state transition functionMat2
: parameter used in the linear state transition functionTMat
: parameter used in the non-linear output functionDoPeriodCertification
: whether or not period certification is performed in initialization
Public Types
-
using
param_type
= typename impl::param_type¶ Type of the generator parameter set.
Public Functions
-
template<TINYMT_CPP_ENABLE_WHEN(!status_type::is_dynamic::value)> tinymt_engine (result_type seed=default_seed)
Constructs the engine (non-DC mode).
- Parameters
seed
: random seed
-
template<TINYMT_CPP_ENABLE_WHEN(status_type::is_dynamic::value)>
tinymt_engine
(const param_type ¶m, result_type seed = default_seed)¶ Constructs the engine (DC mode).
- Parameters
param
: parameter setseed
: random seed
-
void
seed
(result_type value = default_seed)¶ Reinitializes the engine.
- Parameters
value
: random seed
-
void
discard
(unsigned long long z)¶ Advances the state of the engine by the given amount.
- Parameters
z
: number of advances
-
result_type
operator()
()¶ Returns the next pseudo-random number.
- Return
generated value
Public Static Functions
-
constexpr result_type
min
()¶ Returns the smallest possible value in the output range.
- Return
smallest value
-
constexpr result_type
max
()¶ Returns the largest possible value in the output range.
- Return
largest value
Public Static Attributes
-
constexpr std::size_t
word_size
= WordSize¶ Word size that determines the range of numbers generated by the engine.
-
constexpr std::size_t
state_size
= impl::state_size¶ Size of the state of the generator in words.
-
constexpr result_type
default_seed
= 1¶ Default seed.
Friends
-
friend bool
operator==
(const tinymt_engine &a, const tinymt_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 tinymt_engine &a, const tinymt_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