...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::subtract_with_carry
// In header: <boost/random/subtract_with_carry.hpp> template<typename IntType, IntType m, unsigned int s, unsigned int r, IntType val> class subtract_with_carry { public: // types typedef IntType result_type; // construct/copy/destruct subtract_with_carry(); subtract_with_carry(uint32_t); template<typename Generator> subtract_with_carry(Generator &); template<typename It> subtract_with_carry(It &, It); // public member functions void seed(); void seed(uint32_t); template<typename Generator> void seed(Generator &); template<typename It> void seed(It &, It); result_type min() const; result_type max() const; result_type operator()(); // public static functions static bool validation(result_type); static const bool has_fixed_range; static const result_type min_value; static const result_type max_value; static const result_type modulus; static const unsigned int long_lag; static const unsigned int short_lag; };
Instantiations of subtract_with_carry
model a pseudo-random number generator . The algorithm is described in
"A New Class of Random Number Generators", George Marsaglia and Arif Zaman, Annals of Applied Probability, Volume 1, Number 3 (1991), 462-480.