class
<random>
std::minstd_rand0
typedef linear_congruential_engine<uint_fast32_t, 16807, 0, 2147483647> minstd_rand0;
Minimal Standard minstd_rand0 generator
A simple multiplicative congruential pseudo-random number generator (a type of linear_congruential_engine).
The generator has a single value as state, which is modified by its transition algorithm on each advance like x is modified in the following piece of code:
|
x = x * 16807 % 2147483647
| |
It is an instantiation of the linear_congruential_engine with the following template parameters:
parameter | name | value | notes |
a | multiplier | 16807 | 75 |
c | increment | 0 | |
m | modulus | 2147483647 | 231-1 |
Member types
The following alias is a member type of minstd_rand0:
member type | definition | notes |
result_type | uint_fast32_t | The type of the numbers generated. |
Member functions
As a linear_congruential_engine types, it has the following member functions:
- (constructor)
- Construct linear congruential engine (public member function)
- min
- Minimum value (public static member function)
- max
- Maximum value (public static member function)
- seed
- Seed engine (public member function)
- operator()
- Generate random number (public member function
)
- discard
- Advance internal state (public member function)
Non-member functions
As a linear_congruential_engine type, the following operator overloads may be applied to it:
- operator<<
- Insert into output stream (function template
)
- operator>>
- Extract from input stream (function template
)
- relational operators
- Relational operators (function template
)
Member constexpr constants
member constant | definition | notes |
multiplier | 16807 | The multiplier (a) used in the transition algorithm on each advance. |
increment | 0 | The increment (c) used in the transition algorithm on each advance. |
modulus | 2147483647 | The modulus (m) used in the transition algorithm on each advance. |
default_seed | 1 | The default seed used on construction or seeding. |