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_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 {
  // types
  typedef RealType result_type;

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

subtract_with_carry_01 public construct/copy/destruct

  1. subtract_with_carry_01();
  2. subtract_with_carry_01(uint32_t value);
  3. template<typename It> subtract_with_carry_01(It & first, It last);

subtract_with_carry_01 public member functions

  1. void seed(uint32_t value = 19780503u);
  2. template<typename It> void seed(It & first, It last);
  3. result_type min() const;
  4. result_type max() const;
  5. result_type operator()();

subtract_with_carry_01 public static functions

  1. static bool validation(result_type x);