Boost C++ Libraries

...one 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.
PrevUpHomeNext

Class template threefry_engine

boost::compute::threefry_engine — Threefry pseudorandom number generator.

Synopsis

// In header: <boost/compute/random/threefry_engine.hpp>

template<typename T = uint_> 
class threefry_engine {
public:
  // types
  typedef T result_type;

  // construct/copy/destruct
  explicit threefry_engine(command_queue &, ulong_ = default_seed);
  threefry_engine(const threefry_engine< T > &);
  threefry_engine< T > & operator=(const threefry_engine< T > &);
  ~threefry_engine();

  // public member functions
  void seed(ulong_, command_queue &);
  void seed(command_queue &);
  template<typename OutputIterator> 
    void generate(OutputIterator, OutputIterator, command_queue &);
  template<typename OutputIterator, typename Function> 
    void generate(OutputIterator, OutputIterator, Function, command_queue &);
  void discard(size_t, command_queue &);

  // private member functions
  void load_program();

  // public data members
  static const ulong_ default_seed;
};

Description

threefry_engine public construct/copy/destruct

  1. explicit threefry_engine(command_queue & queue, ulong_ value = default_seed);
    Creates a new threefry_engine and seeds it with value.
  2. threefry_engine(const threefry_engine< T > & other);
    Creates a new threefry_engine object as a copy of other.
  3. threefry_engine< T > & operator=(const threefry_engine< T > & other);
    Copies other to *this.
  4. ~threefry_engine();
    Destroys the threefry_engine object.

threefry_engine public member functions

  1. void seed(ulong_ value, command_queue & queue);

    Seeds the random number generator with value.

    If no seed value is provided, default_seed is used.

    Parameters:

    queue

    command queue to perform the operation

    value

    seed value for the random-number generator

  2. void seed(command_queue & queue);
    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
  3. template<typename OutputIterator> 
      void generate(OutputIterator first, OutputIterator last, 
                    command_queue & queue);
    Generates random numbers and stores them to the range [first, last).
  4. template<typename OutputIterator, typename Function> 
      void generate(OutputIterator first, OutputIterator last, Function op, 
                    command_queue & queue);

    Generates random numbers, transforms them with op, and then stores them to the range [first, last).

  5. void discard(size_t z, command_queue & queue);
    Generates z random numbers and discards them.

threefry_engine private member functions

  1. void load_program();

PrevUpHomeNext