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

Class template triangle_distribution



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

template<typename RealType = double> 
class triangle_distribution {
  // types
  typedef RealType input_type; 
  typedef RealType result_type;

  // construct/copy/destruct
  triangle_distribution(result_type = result_type(0), 
                        result_type = result_type(0.5), 
                        result_type = result_type(1));

  // public member functions
  result_type a() const;
  result_type b() const;
  result_type c() const;
  void reset();
  template<typename Engine> result_type operator()(Engine &);


Instantiations of triangle_distribution model a random distribution . A triangle_distribution has three parameters, a, b, and c, which are the smallest, the most probable and the largest values of the distribution respectively.

triangle_distribution public construct/copy/destruct

  1. triangle_distribution(result_type a_arg = result_type(0), 
                          result_type b_arg = result_type(0.5), 
                          result_type c_arg = result_type(1));

    Constructs a triangle_distribution with the parameters a, b, and c.

    Preconditions: a <= b <= c.

triangle_distribution public member functions

  1. result_type a() const;

    Returns the a parameter of the distribution

  2. result_type b() const;

    Returns the b parameter of the distribution

  3. result_type c() const;

    Returns the c parameter of the distribution

  4. void reset();
  5. template<typename Engine> result_type operator()(Engine & eng);