...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::random::discard_block
// 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; };
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