Boost C++ Libraries 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.

Class template 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 {
  // types
  typedef IntType result_type;

  // construct/copy/destruct
  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.

subtract_with_carry public construct/copy/destruct

  1. subtract_with_carry();
  2. subtract_with_carry(uint32_t value);
  3. template<typename Generator> subtract_with_carry(Generator & gen);
  4. template<typename It> subtract_with_carry(It & first, It last);

subtract_with_carry public member functions

  1. void seed();
  2. void seed(uint32_t value);
  3. template<typename Generator> void seed(Generator & gen);
  4. template<typename It> void seed(It & first, It last);
  5. result_type min() const;
  6. result_type max() const;
  7. result_type operator()();

subtract_with_carry public static functions

  1. static bool validation(result_type x);