...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_01
// In header: <boost/random/subtract_with_carry.hpp> template<typename RealType, int w, unsigned int s, unsigned int r, int val = 0> class subtract_with_carry_01 { public: // types typedef RealType result_type; // construct/copy/destruct subtract_with_carry_01(); subtract_with_carry_01(uint32_t); template<typename It> subtract_with_carry_01(It &, It); // public member functions void seed(uint32_t = 19780503u); 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 int word_size; 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.