Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.
PrevUpHomeNext

Class template discard_block

boost::random::discard_block

Synopsis

// In header: <boost/random/discard_block.hpp>

template<typename UniformRandomNumberGenerator, unsigned int p, 
         unsigned int r> 
class discard_block {
public:
  // types
  typedef UniformRandomNumberGenerator base_type;  
  typedef base_type::result_type       result_type;

  // construct/copy/destruct
  discard_block();
  discard_block(const base_type &);
  template<typename T> discard_block(T);
  template<typename It> discard_block(It &, It);

  // public member functions
  void seed();
  template<typename T> void seed(T);
  template<typename It> void seed(It &, It);
  const base_type & base() const;
  result_type operator()();
  result_type min() const;
  result_type max() const;

  // public static functions
  static bool validation(result_type);
  static const bool has_fixed_range;
  static const unsigned int total_block;
  static const unsigned int returned_block;
};

Description

The class template discard_block is a model of pseudo-random number generator . It modifies another generator by discarding parts of its output. Out of every block of r results, the first p will be returned and the rest discarded.

Requires: 0 < p <= r

discard_block public construct/copy/destruct

  1. discard_block();
  2. discard_block(const base_type & rng);
  3. template<typename T> discard_block(T s);
  4. template<typename It> discard_block(It & first, It last);

discard_block public member functions

  1. void seed();
  2. template<typename T> void seed(T s);
  3. template<typename It> void seed(It & first, It last);
  4. const base_type & base() const;
  5. result_type operator()();
  6. result_type min() const;
  7. result_type max() const;

discard_block public static functions

  1. static bool validation(result_type x);

PrevUpHomeNext