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 an the documentation for an old version of boost. Click here for the latest Boost documentation.

Class template linear_feedback_shift



// In header: <boost/random/linear_feedback_shift.hpp>

template<typename UIntType, int w, int k, int q, int s, UIntType val> 
class linear_feedback_shift {
  // types
  typedef UIntType result_type;

  // construct/copy/destruct
  linear_feedback_shift(UIntType = 341);
  template<typename It> linear_feedback_shift(It &, It);

  // public member functions
  result_type min() const;
  result_type max() const;
  void seed(UIntType = 341) ;
  template<typename It> void seed(It &, It) ;
  result_type operator()() ;

  // public static functions
  static bool validation(result_type) ;
  static const bool has_fixed_range;
  static const int word_size;
  static const int exponent1;
  static const int exponent2;
  static const int step_size;


Instatiation of linear_feedback_shift model a pseudo-random number generator . It was originally proposed in

"Random numbers generated by linear recurrence modulo two.", Tausworthe, R. C.(1965), Mathematics of Computation 19, 201-209.

linear_feedback_shift public construct/copy/destruct

  1. linear_feedback_shift(UIntType s0 = 341);
  2. template<typename It> linear_feedback_shift(It & first, It last);

linear_feedback_shift public member functions

  1. result_type min() const;
  2. result_type max() const;
  3. void seed(UIntType s0 = 341) ;
  4. template<typename It> void seed(It & first, It last) ;
  5. result_type operator()() ;

linear_feedback_shift public static functions

  1. static bool validation(result_type x) ;