Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Class template xor_combine_engine

boost::random::xor_combine_engine

Synopsis

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

template<typename URNG1,  s1, typename URNG2,  s2> 
class xor_combine_engine {
public:
  // types
  typedef                    ; 
  typedef                    ; 
  typedef  ;

  // construct/copy/destruct
  ();
  (, );
  ();
  template<typename SeedSeq> ();
  template<typename It> (, );

  // public member functions
   ();
   ();
  template<typename SeedSeq>  ();
  template<typename It>  (, );
   () ;
   () ;
   ();
  template<typename Iter>  (, );
   ();

  // public static functions
   ();
   ();

  // friend functions
  template<typename CharT, typename Traits> 
     
    (, 
               xor_combine_engine &);
  template<typename CharT, typename Traits> 
     
    (, 
               xor_combine_engine &);
   (xor_combine_engine &, xor_combine_engine &);
   (xor_combine_engine &, xor_combine_engine &);

  // public data members
  static  has_fixed_range;
  static  shift1;
  static  shift2;
};

Description

Instantiations of xor_combine_engine 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_engine public construct/copy/destruct

  1. ();

    Constructors a xor_combine_engine by default constructing both base generators.

  2. ( rng1,  rng2);

    Constructs a xor_combine by copying two base generators.

  3. ( v);

    Constructs a xor_combine_engine, seeding both base generators with v.

    [Warning] Warning

    The exact algorithm used by this function may change in the future.

  4. template<typename SeedSeq> ( seq);

    Constructs a xor_combine_engine, seeding both base generators with values produced by seq.

  5. template<typename It> ( first,  last);

    Constructs a xor_combine_engine, 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_engine public member functions

  1.  ();

    Calls seed() for both base generators.

  2.  ( v);

    seeds both base generators with v.

  3. template<typename SeedSeq>  ( seq);

    seeds both base generators with values produced by seq.

  4. template<typename It>  ( first,  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.

  5.  () ;

    Returns the first base generator.

  6.  () ;

    Returns the second base generator.

  7.  ();

    Returns the next value of the generator.

  8. template<typename Iter>  ( first,  last);

    Fills a range with random values

  9.  ( z);

    Advances the state of the generator by z.

xor_combine_engine public static functions

  1.  ();

    Returns the smallest value that the generator can produce.

  2.  ();

    Returns the largest value that the generator can produce.

xor_combine_engine friend functions

  1. template<typename CharT, typename Traits> 
       
      ( os, 
                 xor_combine_engine & s);

    Writes the textual representation of the generator to a std::ostream.

  2. template<typename CharT, typename Traits> 
       
      ( is, 
                 xor_combine_engine & s);

    Reads the textual representation of the generator from a std::istream.

  3.  (xor_combine_engine & x, xor_combine_engine & y);

    Returns true if the two generators will produce identical sequences.

  4.  (xor_combine_engine & lhs, 
                    xor_combine_engine & rhs);

    Returns true if the two generators will produce different sequences.


PrevUpHomeNext