From Cppreference
|
|
|
|
|
template<class UIntType, UIntType a, UIntType c, UIntType m>
class linear_congruential_engine;
|
|
(C++11 feature)
|
|
|
A linear_congruential_engine produces unsigned integer pseudorandom numbers. The state of a LCG is of size 1 and consists of a single integer.
The transition algorithm of the LCG function is <math>x_{i+1}\leftarrow(ax_{i} + c) \bmod m</math>.
[edit] Member types
|
Member type
|
Definition
|
|
result_type
|
The integral type generated by the engine. Results are undefined if this is not an unsigned integral type.
|
[edit] Member variables
|
|
The multiplier term (a). (public static member constant)
|
|
|
The increment term (c). (public static member constant)
|
|
|
The modulus term (m). (public static member constant)
|
|
|
The default seed (1). (public static member constant)
|
[edit] Member functions
Construction and Seeding
|
|
|
Constructs the engine. (public member function)
|
|
|
Sets the current state of the engine. (public member function)
|
Generation
|
|
|
Advances the engine's state and returns the generated value. (public member function)
|
|
|
Advances the engine's state by a specified amount. (public member function)
|
Characteristics
|
|
|
Gets the smallest possible value in the output range. (public member function)
|
|
|
Gets the largest possible value in the output range. (public member function)
|
[edit] Non-member functions
|
|
Compare two LCGs for equality. (function)
|
|
|
Marshalls the engine state to an output stream. (function)
|
|
|
Unmarshalls the engine state from an input stream. (function)
|