Scroll to navigation

std::discard_block_engine(3) C++ Standard Libary std::discard_block_engine(3)

NAME

std::discard_block_engine - std::discard_block_engine

Synopsis


Defined in header <random>
template<


class Engine, (since C++11)
std::size_t P, std::size_t R


> class discard_block_engine;


discard_block_engine is a pseudo-random number engine adaptor that discards a
certain amount of data produced by the base engine. From each block of size P
generated by the base engine, the adaptor keeps only R numbers, discarding the rest.

Template parameters


Engine - the type of the wrapped engine.
P - the size of a block. Expected that \(\small{P>0}\)P > 0.
R - the number of used numbers per block. Expected that \(\small{0<R\le P}\)0 <
R ≤ P.

Type requirements


-
Engine must meet the requirements of RandomNumberEngine.

Member types


Member type Definition
result_type(C++11) Engine::result_type

Member functions


constructor constructs the engine adaptor
(C++11) (public member function)
seed sets the state of the underlying engine
(C++11) (public member function)
base returns the underlying engine
(C++11) (public member function)

Generation


operator() advances the state of the underlying engine and returns the
(C++11) generated value
(public member function)
discard advances the adaptor's state by a specified amount
(C++11) (public member function)

Characteristics


min gets the smallest possible value in the output range of the
[static] (C++11) underlying engine.
(public static member function)
max gets the largest possible value in the output range of the
[static] (C++11) underlying engine.
(public static member function)

Non-member functions


operator== compares the internal states of the adaptors and
operator!= underlying engines
(C++11) (function)
(C++11)(removed in C++20)
operator<< performs stream input and output on pseudo-random number
operator>> engine adaptor
(C++11) (function)

Member constants


constexpr size_t block_size the size of the block, P
[static] (C++11) (public static member constant)
constexpr size_t used_block the number of used numbers per block, R
[static] (C++11) (public static member constant)

2022.07.31 http://cppreference.com