A
linear_congruential_engine random number engine
produces unsigned integer random numbers
. The state
xi
of a
linear_congruential_engine object
x
is of size
1
and consists of a single integer
. The transition algorithm
is a modular linear function of the form
TA(xi)=(a⋅xi+c)modm;
the generation algorithm
is
GA(xi)=xi+1.template<class UIntType, UIntType a, UIntType c, UIntType m>
class linear_congruential_engine {
public:
using result_type = UIntType;
static constexpr result_type multiplier = a;
static constexpr result_type increment = c;
static constexpr result_type modulus = m;
static constexpr result_type min() { return c == 0u ? 1u: 0u; }
static constexpr result_type max() { return m - 1u; }
static constexpr result_type default_seed = 1u;
linear_congruential_engine() : linear_congruential_engine(default_seed) {}
explicit linear_congruential_engine(result_type s);
template<class Sseq> explicit linear_congruential_engine(Sseq& q);
void seed(result_type s = default_seed);
template<class Sseq> void seed(Sseq& q);
result_type operator()();
void discard(unsigned long long z);
};