class template
<random>
std::subtract_with_carry_engine
template <class UIntType, size_t w, size_t s, size_t r>class subtract_with_carry_engine;
Subtract-with-carry random number engine
A pseudo-random number generator engine that produces unsigned integer numbers.
The algorithm used by this engine is a lagged fibonacci generator, with a state sequence of r integer elements, plus one carry value.
Template parameters
- UIntType
- An unsigned integer type.
Values produced by the engine are of this type.
- w
- Word size: Number of bits of each word in the state sequence.
This parameter should be greater than zero and lower than numeric_limits<UIntType>::digits.
- s
- Short lag: Number of elements between advances.
This parameter should be greater than zero and lower than r.
- r
- Long lag: Distance between operand values. This determines the degree of recurrence in the generated series.
Member types
The following alias is a member type of subtract_with_carry_engine:
member type | definition | notes |
result_type | The first template parameter (UIntType) | The type of the numbers generated. |
Member functions
- (constructor)
- Construct subtract-with-carry 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
- 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 |
word_size | The second template parameter (w) | The number of bits of each word in the state sequence. |
short_lag | The third template parameter (s) | The short lag value. |
long_lag | The fourth template parameter (r) | The long lag value. |
default_seed | 19780503u | The default seed used on construction or seeding. |