discard_block Class

Discards portions of a random sequence.

template<class Engine,
   int P, int R>
   class discard_block {
   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(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()();
   Engine stored_eng;       // exposition only
   int count;               // exposition only


The stored random engine type.


The total block size.


The used block size.

The template class decribes 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.

Header: <random>

Namespace: std::tr1

Community Additions