discard_block_engine Class

discard_block_engine Class

Generates a random sequence by discarding values returned by its base engine.

template<class Engine,
    int P, int R>
    class discard_block_engine {
    typedef Engine base_type;
    typedef typename base_type::result_type result_type;
    static const int block_size = P;
    static const int used_block = R;
    explicit discard_block_engine(const base_type& eng);
    explicit discard_block_engine(result_type x0);
    explicit discard_block_engine(seed_seq& seq);
    void seed();
    void seed(result_type x0);
    void seed(seed_seq& seq);
    const base_type& base() const;
    static const result_type min();
    static const result_type max();
    result_type operator()();
    void discard(unsigned long long count);
    Engine stored_eng;
    int count;


The stored random engine type.


The total block size.


The used block size.

The template class describes a <random> that produces values by discarding some of the values returned by its base engine. Each cycle of the compound engine begins by returning R values successively produced by the base engine and ends by discarding P - R such values. The engine's is the state of stored_eng followed by the number of calls to operator() that have occurred since the beginning of the current cycle.

The value of the template argument R must be less than or equal to the value of the template argument P.

Header: <random>

Namespace: std

Community Additions

© 2016 Microsoft