Reference

<random>

class
<random>

std::minstd_rand

typedef linear_congruential_engine<uint_fast32_t, 48271, 0, 2147483647> minstd_rand;
Minimal Standard minstd_rand 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:
1
x = x * 48271 %

It is an instantiation of the linear_congruential_engine with the following template parameters:
parameternamevaluenotes
amultiplier48271Prime multiplier
cincrement0
mmodulus2147483647 231-1

It is generally considered to generate slightly more random sequences than minstd_rand0 with the same overhead.

Member types

The following alias is a member type of minstd_rand:

member typedefinitionnotes
result_typeuint_fast32_tThe type of the numbers generated.

Member functions

As a linear_congruential_engine type, 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 constantdefinitionnotes
multiplier48271The multiplier (a) used in the transition algorithm on each advance.
increment0The increment (c) used in the transition algorithm on each advance.
modulus2147483647The modulus (m) used in the transition algorithm on each advance.
default_seed1The default seed used on construction or seeding.

See also

linear_congruential_engine
Linear congruential random number engine (class template)

AltStyle によって変換されたページ (->オリジナル) /