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


Member types

The following alias is a member type of discard_block_engine:

member typedefinitionnotes
result_typeEngine::result_typeThe type of the numbers generated.

Member functions


Non-member functions


Member constexpr constants

member constantdefinitionnotes
block_sizeThe second template parameter (p)The number of elements in each block.
used_blockThe third template parameter (r)The number of elements in the block that are used (not discarded).

See also