![]() |
Home | Libraries | People | FAQ | More |
boost::variate_generator
// In header: <boost/random/variate_generator.hpp> template<typename Engine, typename Distribution> class variate_generator { public: // types typedef ; typedef Engine ; typedef Distribution ; typedef ; // construct/copy/destruct (Engine, Distribution); // public member functions (); template<typename T> (const T &); (); const () ; distribution_type & (); const distribution_type & () ; () ; () ; };
A random variate generator is used to join a random number generator together with a random number distribution. Boost.Random provides a vast choice of generators as well as distributions .
The argument for the template parameter Engine shall be of the form U, U&, or U*, where U models a uniform random number generator . Then, the member engine_value_type names U (not the pointer or reference to U).
Specializations of variate_generator
satisfy the requirements of CopyConstructible. They also satisfy the requirements of Assignable unless the template parameter Engine is of the form U&.
The complexity of all functions specified in this section is constant. No function described in this section except the constructor throws an exception.
variate_generator
public
construct/copy/destruct(Engine e, Distribution d);
Constructs a
object with the associated uniform random number generator eng and the associated random distribution d.variate_generator
Throws: If and what the copy constructor of Engine or Distribution throws.
variate_generator
public member functions();
Returns: distribution()(engine())
template<typename T> (const T & value);
Returns: distribution()(engine(), value).
();
Returns: A reference to the associated uniform random number generator.
const () ;
Returns: A reference to the associated uniform random number generator.
distribution_type & ();
Returns: A reference to the associated random distribution .
const distribution_type & () ;
Returns: A reference to the associated random distribution.
() ;
Precondition: distribution().min() is well-formed
Returns: distribution().min()
() ;
Precondition: distribution().max() is well-formed
Returns: distribution().max()