Share via


discard_block Class

Generates a random sequence by discarding values returned by its base engine. Retained for TR1 compatibility. Use discard_block_engine Class instead.

template<class Engine,
   int P, int R>
   class discard_block {
public:
   typedef discard_block<Engine, P, R> _MyT;
   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();
   discard_block(const discard_block& right);
   discard_block(discard_block& right);
   explicit discard_block(const base_type& eng);
   explicit discard_block(result_type seed);
   template<class Gen>
      discard_block(Gen& gen);
   void seed();
   template<class Gen>
      void seed(Gen& gen);
   const base_type& base() const;
   result_type min() const;
   result_type max() const;
   result_type operator()();
private:
   Engine stored_eng;       // exposition only
   int count;               // exposition only
   };

Parameters

  • Engine
    The stored random engine type.

  • P
    The total block size.

  • R
    The used block size.

Remarks

The template class describes a compound engine 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::base

discard_block::base_type

discard_block::discard_block

discard_block::operator()

discard_block::seed

Other Resources

<random> Members