GNU g++  v5.2.1
GNU Standard C++
Random Number Distributions
Collaboration diagram for Random Number Distributions:

Modules

 Normal Distributions
 
 Uniform Distributions
 

Detailed Description

A model of a linear congruential random number generator.

A random number generator that produces pseudorandom numbers via linear function:

\[ x_{i+1}\leftarrow(ax_{i} + c) \bmod m \]

The template parameter _UIntType must be an unsigned integral type large enough to store values up to (__m-1). If the template parameter __m is 0, the modulus __m used is std::numeric_limits<_UIntType>::max() plus 1. Otherwise, the template parameters __a and __c must be less than __m.

The size of the state is $1$.

The type of the generated random value.

The multiplier.

An increment.

The modulus.

Constructs a linear_congruential_engine random number generator engine with seed __s. The default seed value is 1.

Parameters
__sThe initial seed value.

Constructs a linear_congruential_engine random number generator engine seeded from the seed sequence __q.

Parameters
__qthe seed sequence.

Reseeds the linear_congruential_engine random number generator engine sequence to the seed __s.

Parameters
__sThe new seed.

Reseeds the linear_congruential_engine random number generator engine sequence using values from the seed sequence __q.

Parameters
__qthe seed sequence.

Gets the smallest possible value in the output range.

The minimum depends on the __c parameter: if it is zero, the minimum generated must be > 0, otherwise 0 is allowed.

Gets the largest possible value in the output range.

Discard a sequence of random numbers.

Gets the next random number in the sequence.

Compares two linear congruential random number generator objects of the same type for equality.

Parameters
__lhsA linear congruential random number generator object.
__rhsAnother linear congruential random number generator object.
Returns
true if the infinite sequences of generated values would be equal, false otherwise.

Writes the textual representation of the state x(i) of x to __os.

Parameters
__osThe output stream.
__lcrA % linear_congruential_engine random number generator.
Returns
__os.

Sets the state of the engine by reading its textual representation from __is.

The textual representation must have been previously written using an output stream whose imbued locale and whose type's template specialization arguments _CharT and _Traits were the same as those of __is.

Parameters
__isThe input stream.
__lcrA % linear_congruential_engine random number generator.
Returns
__is.

Compares two linear congruential random number generator objects of the same type for inequality.

Parameters
__lhsA linear congruential random number generator object.
__rhsAnother linear congruential random number generator object.
Returns
true if the infinite sequences of generated values would be different, false otherwise.

A generalized feedback shift register discrete random number generator.

This algorithm avoids multiplication and division and is designed to be friendly to a pipelined architecture. If the parameters are chosen correctly, this generator will produce numbers with a very long period and fairly good apparent entropy, although still not cryptographically strong.

The best way to use this generator is with the predefined mt19937 class.

This algorithm was originally invented by Makoto Matsumoto and Takuji Nishimura.

Template Parameters
__wWord size, the number of bits in each element of the state vector.
__nThe degree of recursion.
__mThe period parameter.
__rThe separation point bit index.
__aThe last row of the twist matrix.
__uThe first right-shift tempering matrix parameter.
__dThe first right-shift tempering matrix mask.
__sThe first left-shift tempering matrix parameter.
__bThe first left-shift tempering matrix mask.
__tThe second left-shift tempering matrix parameter.
__cThe second left-shift tempering matrix mask.
__lThe second right-shift tempering matrix parameter.
__fInitialization multiplier.

The type of the generated random value.

Constructs a mersenne_twister_engine random number generator engine seeded from the seed sequence __q.

Parameters
__qthe seed sequence.

Gets the smallest possible value in the output range.

Gets the largest possible value in the output range.

Discard a sequence of random numbers.

Compares two % mersenne_twister_engine random number generator objects of the same type for equality.

Parameters
__lhsA % mersenne_twister_engine random number generator object.
__rhsAnother % mersenne_twister_engine random number generator object.
Returns
true if the infinite sequences of generated values would be equal, false otherwise.

Inserts the current state of a % mersenne_twister_engine random number generator engine __x into the output stream __os.

Parameters
__osAn output stream.
__xA % mersenne_twister_engine random number generator engine.
Returns
The output stream with the state of __x inserted or in an error state.

Extracts the current state of a % mersenne_twister_engine random number generator engine __x from the input stream __is.

Parameters
__isAn input stream.
__xA % mersenne_twister_engine random number generator engine.
Returns
The input stream with the state of __x extracted or in an error state.

Compares two % mersenne_twister_engine random number generator objects of the same type for inequality.

Parameters
__lhsA % mersenne_twister_engine random number generator object.
__rhsAnother % mersenne_twister_engine random number generator object.
Returns
true if the infinite sequences of generated values would be different, false otherwise.

The Marsaglia-Zaman generator.

This is a model of a Generalized Fibonacci discrete random number generator, sometimes referred to as the SWC generator.

A discrete random number generator that produces pseudorandom numbers using:

\[ x_{i}\leftarrow(x_{i - s} - x_{i - r} - carry_{i-1}) \bmod m \]

The size of the state is $r$ and the maximum period of the generator is $(m^r - m^s - 1)$.

The type of the generated random value.

Constructs an explicitly seeded % subtract_with_carry_engine random number generator.

Constructs a subtract_with_carry_engine random number engine seeded from the seed sequence __q.

Parameters
__qthe seed sequence.

Seeds the initial state $x_0$ of the random number generator.

N1688[4.19] modifies this as follows. If __value == 0, sets value to 19780503. In any case, with a linear congruential generator lcg(i) having parameters $ m_{lcg} = 2147483563, a_{lcg} = 40014, c_{lcg} = 0, and lcg(0) = value $, sets $ x_{-r} \dots x_{-1} $ to $ lcg(1) \bmod m \dots lcg(r) \bmod m $ respectively. If $ x_{-1} = 0 $ set carry to 1, otherwise sets carry to 0.

Seeds the initial state $x_0$ of the % subtract_with_carry_engine random number generator.

Gets the inclusive minimum value of the range of random integers returned by this generator.

Gets the inclusive maximum value of the range of random integers returned by this generator.

Discard a sequence of random numbers.

Gets the next random number in the sequence.

Compares two % subtract_with_carry_engine random number generator objects of the same type for equality.

Parameters
__lhsA % subtract_with_carry_engine random number generator object.
__rhsAnother % subtract_with_carry_engine random number generator object.
Returns
true if the infinite sequences of generated values would be equal, false otherwise.

Inserts the current state of a % subtract_with_carry_engine random number generator engine __x into the output stream __os.

Parameters
__osAn output stream.
__xA % subtract_with_carry_engine random number generator engine.
Returns
The output stream with the state of __x inserted or in an error state.

Extracts the current state of a % subtract_with_carry_engine random number generator engine __x from the input stream __is.

Parameters
__isAn input stream.
__xA % subtract_with_carry_engine random number generator engine.
Returns
The input stream with the state of __x extracted or in an error state.

The state of the generator. This is a ring buffer.

< The carry

< Current index of x(i - r).

Compares two % subtract_with_carry_engine random number generator objects of the same type for inequality.

Parameters
__lhsA % subtract_with_carry_engine random number generator object.
__rhsAnother % subtract_with_carry_engine random number generator object.
Returns
true if the infinite sequences of generated values would be different, false otherwise.

Produces random numbers from some base engine by discarding blocks of data.

0 <= __r <= __p

The type of the generated random value.

Constructs a default discard_block_engine engine.

The underlying engine is default constructed as well.

Copy constructs a discard_block_engine engine.

Copies an existing base class random number generator.

Parameters
__rngAn existing (base class) engine object.

Move constructs a discard_block_engine engine.

Copies an existing base class random number generator.

Parameters
__rngAn existing (base class) engine object.

Seed constructs a discard_block_engine engine.

Constructs the underlying generator engine seeded with __s.

Parameters
__sA seed value for the base class engine.

Generator construct a discard_block_engine engine.

Parameters
__qA seed sequence.

Reseeds the discard_block_engine object with the default seed for the underlying base class generator engine.

Reseeds the discard_block_engine object with the default seed for the underlying base class generator engine.

Reseeds the discard_block_engine object with the given seed sequence.

Parameters
__qA seed generator function.

Gets a const reference to the underlying generator engine object.

Gets the minimum value in the generated random number range.

Gets the maximum value in the generated random number range.

Discard a sequence of random numbers.

Gets the next value in the generated random number sequence.

Compares two discard_block_engine random number generator objects of the same type for equality.

Parameters
__lhsA discard_block_engine random number generator object.
__rhsAnother discard_block_engine random number generator object.
Returns
true if the infinite sequences of generated values would be equal, false otherwise.

Inserts the current state of a discard_block_engine random number generator engine __x into the output stream __os.

Parameters
__osAn output stream.
__xA discard_block_engine random number generator engine.
Returns
The output stream with the state of __x inserted or in an error state.

Extracts the current state of a % subtract_with_carry_engine random number generator engine __x from the input stream __is.

Parameters
__isAn input stream.
__xA discard_block_engine random number generator engine.
Returns
The input stream with the state of __x extracted or in an error state.

Compares two discard_block_engine random number generator objects of the same type for inequality.

Parameters
__lhsA discard_block_engine random number generator object.
__rhsAnother discard_block_engine random number generator object.
Returns
true if the infinite sequences of generated values would be different, false otherwise.

Produces random numbers by combining random numbers from some base engine to produce random numbers with a specifies number of bits __w.

The type of the generated random value.

Constructs a default independent_bits_engine engine.

The underlying engine is default constructed as well.

Copy constructs a independent_bits_engine engine.

Copies an existing base class random number generator.

Parameters
__rngAn existing (base class) engine object.

Move constructs a independent_bits_engine engine.

Copies an existing base class random number generator.

Parameters
__rngAn existing (base class) engine object.

Seed constructs a independent_bits_engine engine.

Constructs the underlying generator engine seeded with __s.

Parameters
__sA seed value for the base class engine.

Generator construct a independent_bits_engine engine.

Parameters
__qA seed sequence.

Reseeds the independent_bits_engine object with the default seed for the underlying base class generator engine.

Reseeds the independent_bits_engine object with the default seed for the underlying base class generator engine.

Reseeds the independent_bits_engine object with the given seed sequence.

Parameters
__qA seed generator function.

Gets a const reference to the underlying generator engine object.

Gets the minimum value in the generated random number range.

Gets the maximum value in the generated random number range.

Discard a sequence of random numbers.

Gets the next value in the generated random number sequence.

Compares two independent_bits_engine random number generator objects of the same type for equality.

Parameters
__lhsA independent_bits_engine random number generator object.
__rhsAnother independent_bits_engine random number generator object.
Returns
true if the infinite sequences of generated values would be equal, false otherwise.

Extracts the current state of a % subtract_with_carry_engine random number generator engine __x from the input stream __is.

Parameters
__isAn input stream.
__xA independent_bits_engine random number generator engine.
Returns
The input stream with the state of __x extracted or in an error state.

Compares two independent_bits_engine random number generator objects of the same type for inequality.

Parameters
__lhsA independent_bits_engine random number generator object.
__rhsAnother independent_bits_engine random number generator object.
Returns
true if the infinite sequences of generated values would be different, false otherwise.

Inserts the current state of a independent_bits_engine random number generator engine __x into the output stream __os.

Parameters
__osAn output stream.
__xA independent_bits_engine random number generator engine.
Returns
The output stream with the state of __x inserted or in an error state.

Produces random numbers by combining random numbers from some base engine to produce random numbers with a specifies number of bits __w.

The type of the generated random value.

Constructs a default shuffle_order_engine engine.

The underlying engine is default constructed as well.

Copy constructs a shuffle_order_engine engine.

Copies an existing base class random number generator.

Parameters
__rngAn existing (base class) engine object.

Move constructs a shuffle_order_engine engine.

Copies an existing base class random number generator.

Parameters
__rngAn existing (base class) engine object.

Seed constructs a shuffle_order_engine engine.

Constructs the underlying generator engine seeded with __s.

Parameters
__sA seed value for the base class engine.

Generator construct a shuffle_order_engine engine.

Parameters
__qA seed sequence.

Reseeds the shuffle_order_engine object with the default seed for the underlying base class generator engine.

Reseeds the shuffle_order_engine object with the default seed for the underlying base class generator engine.

Reseeds the shuffle_order_engine object with the given seed sequence.

Parameters
__qA seed generator function.

Gets a const reference to the underlying generator engine object.

Gets the minimum value in the generated random number range.

Gets the maximum value in the generated random number range.

Discard a sequence of random numbers.

Gets the next value in the generated random number sequence.

Compares two shuffle_order_engine random number generator objects of the same type for equality.

Parameters
__lhsA shuffle_order_engine random number generator object.
__rhsAnother shuffle_order_engine random number generator object.
Returns
true if the infinite sequences of generated values would be equal, false otherwise.

Inserts the current state of a shuffle_order_engine random number generator engine __x into the output stream __os.

 @param __os An output stream.
 @param __x  A %shuffle_order_engine random number generator engine.

 @returns The output stream with the state of @p __x inserted or in
 an error state.

Extracts the current state of a % subtract_with_carry_engine random number generator engine __x from the input stream __is.

Parameters
__isAn input stream.
__xA shuffle_order_engine random number generator engine.
Returns
The input stream with the state of __x extracted or in an error state.

Compares two shuffle_order_engine random number generator objects of the same type for inequality.

Parameters
__lhsA shuffle_order_engine random number generator object.
__rhsAnother shuffle_order_engine random number generator object.
Returns
true if the infinite sequences of generated values would be different, false otherwise.

The classic Minimum Standard rand0 of Lewis, Goodman, and Miller.

An alternative LCR (Lehmer Generator function).

The classic Mersenne Twister.

Reference: M. Matsumoto and T. Nishimura, Mersenne Twister: A 623-Dimensionally Equidistributed Uniform Pseudo-Random Number Generator, ACM Transactions on Modeling and Computer Simulation, Vol. 8, No. 1, January 1998, pp 3-30.

An alternative Mersenne Twister.

A standard interface to a platform-specific non-deterministic random number generator (if any are available).

The type of the generated random value.