Share via


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 {
public:
    typedef Engine base_type;
    typedef typename base_type::result_type result_type;
    static const int block_size = P;
    static const int used_block = R;
    discard_block_engine();
    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);
private:
    Engine stored_eng;
    int count;
    };

Parameters

  • Engine
    The stored random engine type.

  • P
    The total block size.

  • R
    The used block size.

Remarks

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 state 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.

Requirements

Header: <random>

Namespace: std

See Also

Reference

<random>

discard_block_engine::base

discard_block_engine::base_type

discard_block_engine::discard

discard_block_engine::discard_block_engine

discard_block_engine::operator()

discard_block_engine::seed

Other Resources

<random> Members