class template
<random>
std::discard_block_engine
template <class Engine, size_t p, size_t r>
class discard_block_engine;
Discard-block random number engine adaptor
An engine adaptor class template that adapts a pseudo-random number generator Engine type by using only r elements of each block of p elements from the sequence it produces, discarding the rest.
The adaptor keeps and internal counter of how many elements have been produced in the current block.
The standard generators ranlux24 and ranlux48 adapt a subtract_with_carry_engine using this adaptor.
Template parameters
- Engine
- A random number engine type. All standard generators, except random_device, are random number engine types.
- p
- Block size: Number of elemens in each block.
size_t is an unsigned integral type.
- r
- Used block: Number of elements in the block that are used (not discarded). The rest (p-r) are discarded.
This parameter should be greater than zero and lower than or equal to p.
size_t is an unsigned integral type.
Template instantiations
- ranlux24
- Ranlux 24 generator (class
)
- ranlux48
- Ranlux 48 generator (class
)
Member types
The following alias is a member type of discard_block_engine:
member type | definition | notes |
result_type | Engine::result_type | The type of the numbers generated. |
Member functions
- (constructor)
- Construct discard-block engine (public member function)
- min
- Minimum value (public static member function)
- max
- Maximum value (public static member function)
- seed
- Seed base engine (public member function)
- operator()
- Generate random number (public member function)
- discard
- Advance internal state (public member function)
- base
- Return base engine (public member function)
Non-member functions
- operator>>
- Extract from input stream (function template
)
- operator<<
- Insert into output stream (function template
)
- relational operators
- Relational operators (function template
)
Member constexpr constants
member constant | definition | notes |
block_size | The second template parameter (p) | The number of elements in each block. |
used_block | The third template parameter (r) | The number of elements in the block that are used (not discarded). |
See also
- ranlux24
- Ranlux 24 generator (class
)
- ranlux48
- Ranlux 48 generator (class
)