CLASS TEMPLATE (3)

NAME
boost::random::xor_combine

SYNOPSIS

// In header: <boost/random/xor_combine.hpp>
template<typename URNG1, int s1, typename URNG2, int s2>
class xor_combine {
public:
  // types
  typedef URNG1                   base1_type;
  typedef URNG2                   base2_type;
  typedef base1_type::result_type result_type;
  // construct/copy/destruct
  xor_combine();
  xor_combine(const base1_type &, const base2_type &);
  xor_combine(const result_type &);
  template<typename It> xor_combine(It &, It);
  // public member functions
  void seed();
  void seed(const result_type &);
  template<typename It> void seed(It &, It);
  const base1_type & base1();
  const base2_type & base2();
  result_type operator()();
  result_type min() const;
  result_type max() const;
  // public static functions
  static bool validation(result_type);
  static const bool has_fixed_range;
  static const int shift1;
  static const int shift2;
};

DESCRIPTION

Instantiations of xor_combine model a pseudo-random number generator . To produce its output it invokes each of the base generators, shifts their results and xors them together.

  xor_combine public construct/copy/destruct

    1.

    xor_combine();

    Constructors a xor_combine by default constructing both base generators.

    2.

    xor_combine(const base1_type & rng1, const base2_type & rng2);

    Constructs a xor_combine by copying two base generators.

    3.

    xor_combine(const result_type & v);

    Constructs a xor_combine, seeding both base generators with v.

    4.

    template<typename It> xor_combine(It & first, It last);

    Constructs a xor_combine, seeding both base generators with values from the iterator range [first, last) and changes first to point to the element after the last one used. If there are not enough elements in the range to seed both generators, throws std::invalid_argument.

  xor_combine public member functions

    1.

    void seed();

    Calls seed() for both base generators.

    2.

    void seed(const result_type & v);

    seeds both base generators with v.

    3.

    template<typename It> void seed(It & first, It last);

    seeds both base generators with values from the iterator range [first, last) and changes first to point to the element after the last one used. If there are not enough elements in the range to seed both generators, throws std::invalid_argument.

    4.

    const base1_type & base1();

    Returns the first base generator.

    5.

    const base2_type & base2();

    Returns the second base generator.

    6.

    result_type operator()();

    Returns the next value of the generator.

    7.

    result_type min() const;

    Returns the smallest value that the generator can produce.

    8.

    result_type max() const;

    Returns the largest value that the generator can produce.

  xor_combine public static functions

    1.

    static bool validation(result_type x);