Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Class template normal_distribution

boost::random::normal_distribution

Synopsis

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

template<typename RealType> 
class normal_distribution {
public:
  // types
  typedef  ; 
  typedef  ;

  // member classes/structs/unions

  class param_type {
  public:
    // types
    typedef normal_distribution ;

    // construct/copy/destruct
    ( = ,  = );

    // public member functions
     () ;
     () ;

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

  // construct/copy/destruct
  ( = ,  = );
  (param_type &);

  // public member functions
   () ;
   () ;
   () ;
   () ;
  param_type () ;
   (param_type &);
   ();
  template<typename Engine>  ();
  template<typename URNG>  (, param_type &);

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

Description

Instantiations of class template normal_distribution model a random distribution . Such a distribution produces random numbers x distributed with probability density function , where mean and sigma are the parameters of the distribution.

The implementation uses the "ziggurat" algorithm, as described in

"The Ziggurat Method for Generating Random Variables", George Marsaglia and Wai Wan Tsang, Journal of Statistical Software, Volume 5, Number 8 (2000), 1-7.

normal_distribution public construct/copy/destruct

  1. ( mean = , 
                                  sigma = );

    Constructs a normal_distribution object. mean and sigma are the parameters for the distribution.

    Requires: sigma >= 0

  2. (param_type & param);

    Constructs a normal_distribution object from its parameters.

normal_distribution public member functions

  1.  () ;

    Returns the mean of the distribution.

  2.  () ;

    Returns the standard deviation of the distribution.

  3.  () ;

    Returns the smallest value that the distribution can produce.

  4.  () ;

    Returns the largest value that the distribution can produce.

  5. param_type () ;

    Returns the parameters of the distribution.

  6.  (param_type & param);

    Sets the parameters of the distribution.

  7.  ();

    Effects: Subsequent uses of the distribution do not depend on values produced by any engine prior to invoking reset.

  8. template<typename Engine>  ( eng);

    Returns a normal variate.

  9. template<typename URNG> 
       ( urng, param_type & param);

    Returns a normal variate with parameters specified by param.

normal_distribution friend functions

  1. template<typename CharT, typename Traits> 
       
      ( os, 
                 normal_distribution & nd);

    Writes a normal_distribution to a std::ostream.

  2. template<typename CharT, typename Traits> 
       
      ( is, 
                 normal_distribution & nd);

    Reads a normal_distribution from a std::istream.

  3.  (normal_distribution & lhs, 
                    normal_distribution & rhs);

    Returns true if the two instances of normal_distribution will return identical sequences of values given equal generators.

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

    Returns true if the two instances of normal_distribution will return different sequences of values given equal generators.


PrevUpHomeNext