Modules | |
Normal Distributions | |
Uniform Distributions | |
A model of a linear congruential random number generator.
A random number generator that produces pseudorandom numbers via linear function:
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 .
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.
__s | The initial seed value. |
Constructs a linear_congruential_engine random number generator engine seeded from the seed sequence __q
.
__q | the seed sequence. |
Reseeds the linear_congruential_engine random number generator engine sequence to the seed __s
.
__s | The new seed. |
Reseeds the linear_congruential_engine random number generator engine sequence using values from the seed sequence __q
.
__q | the 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.
__lhs | A linear congruential random number generator object. |
__rhs | Another linear congruential random number generator object. |
Writes the textual representation of the state x(i) of x to __os
.
__os | The output stream. |
__lcr | A % linear_congruential_engine random number generator. |
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
.
__is | The input stream. |
__lcr | A % linear_congruential_engine random number generator. |
Compares two linear congruential random number generator objects of the same type for inequality.
__lhs | A linear congruential random number generator object. |
__rhs | Another linear congruential random number generator object. |
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.
__w | Word size, the number of bits in each element of the state vector. |
__n | The degree of recursion. |
__m | The period parameter. |
__r | The separation point bit index. |
__a | The last row of the twist matrix. |
__u | The first right-shift tempering matrix parameter. |
__d | The first right-shift tempering matrix mask. |
__s | The first left-shift tempering matrix parameter. |
__b | The first left-shift tempering matrix mask. |
__t | The second left-shift tempering matrix parameter. |
__c | The second left-shift tempering matrix mask. |
__l | The second right-shift tempering matrix parameter. |
__f | Initialization multiplier. |
The type of the generated random value.
Constructs a mersenne_twister_engine random number generator engine seeded from the seed sequence __q
.
__q | the 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.
__lhs | A % mersenne_twister_engine random number generator object. |
__rhs | Another % mersenne_twister_engine random number generator object. |
Inserts the current state of a % mersenne_twister_engine random number generator engine __x
into the output stream __os
.
__os | An output stream. |
__x | A % mersenne_twister_engine random number generator engine. |
__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
.
__is | An input stream. |
__x | A % mersenne_twister_engine random number generator engine. |
__x
extracted or in an error state.Compares two % mersenne_twister_engine random number generator objects of the same type for inequality.
__lhs | A % mersenne_twister_engine random number generator object. |
__rhs | Another % mersenne_twister_engine random number generator object. |
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:
The size of the state is and the maximum period of the generator is .
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
.
__q | the seed sequence. |
Seeds the initial state 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 , sets to respectively. If set carry to 1, otherwise sets carry to 0.
Seeds the initial state 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.
__lhs | A % subtract_with_carry_engine random number generator object. |
__rhs | Another % subtract_with_carry_engine random number generator object. |
Inserts the current state of a % subtract_with_carry_engine random number generator engine __x
into the output stream __os
.
__os | An output stream. |
__x | A % subtract_with_carry_engine random number generator engine. |
__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
.
__is | An input stream. |
__x | A % subtract_with_carry_engine random number generator engine. |
__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.
__lhs | A % subtract_with_carry_engine random number generator object. |
__rhs | Another % subtract_with_carry_engine random number generator object. |
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.
__rng | An existing (base class) engine object. |
Move constructs a discard_block_engine engine.
Copies an existing base class random number generator.
__rng | An existing (base class) engine object. |
Seed constructs a discard_block_engine engine.
Constructs the underlying generator engine seeded with __s
.
__s | A seed value for the base class engine. |
Generator construct a discard_block_engine engine.
__q | A 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.
__q | A 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.
__lhs | A discard_block_engine random number generator object. |
__rhs | Another discard_block_engine random number generator object. |
Inserts the current state of a discard_block_engine random number generator engine __x
into the output stream __os
.
__os | An output stream. |
__x | A discard_block_engine random number generator engine. |
__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
.
__is | An input stream. |
__x | A discard_block_engine random number generator engine. |
__x
extracted or in an error state.Compares two discard_block_engine random number generator objects of the same type for inequality.
__lhs | A discard_block_engine random number generator object. |
__rhs | Another discard_block_engine random number generator object. |
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.
__rng | An existing (base class) engine object. |
Move constructs a independent_bits_engine engine.
Copies an existing base class random number generator.
__rng | An existing (base class) engine object. |
Seed constructs a independent_bits_engine engine.
Constructs the underlying generator engine seeded with __s
.
__s | A seed value for the base class engine. |
Generator construct a independent_bits_engine engine.
__q | A 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.
__q | A 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.
__lhs | A independent_bits_engine random number generator object. |
__rhs | Another independent_bits_engine random number generator object. |
Extracts the current state of a % subtract_with_carry_engine random number generator engine __x
from the input stream __is
.
__is | An input stream. |
__x | A independent_bits_engine random number generator engine. |
__x
extracted or in an error state.Compares two independent_bits_engine random number generator objects of the same type for inequality.
__lhs | A independent_bits_engine random number generator object. |
__rhs | Another independent_bits_engine random number generator object. |
Inserts the current state of a independent_bits_engine random number generator engine __x
into the output stream __os
.
__os | An output stream. |
__x | A independent_bits_engine random number generator engine. |
__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.
__rng | An existing (base class) engine object. |
Move constructs a shuffle_order_engine engine.
Copies an existing base class random number generator.
__rng | An existing (base class) engine object. |
Seed constructs a shuffle_order_engine engine.
Constructs the underlying generator engine seeded with __s
.
__s | A seed value for the base class engine. |
Generator construct a shuffle_order_engine engine.
__q | A 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.
__q | A 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.
__lhs | A shuffle_order_engine random number generator object. |
__rhs | Another shuffle_order_engine random number generator object. |
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
.
__is | An input stream. |
__x | A shuffle_order_engine random number generator engine. |
__x
extracted or in an error state.Compares two shuffle_order_engine random number generator objects of the same type for inequality.
__lhs | A shuffle_order_engine random number generator object. |
__rhs | Another shuffle_order_engine random number generator object. |
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.