![]() |
Home | Libraries | People | FAQ | More |
boost::random::normal_distribution
// In header: <boost/random/normal_distribution.hpp> template<typename RealType = double> class normal_distribution { public: // types typedef RealType ; typedef RealType ; // member classes/structs/unions class param_type { public: // types typedef normal_distribution ; // construct/copy/destruct (RealType = , RealType = ); // public member functions RealType () ; RealType () ; // friend functions template<typename CharT, typename Traits> CharT, Traits > & (CharT, Traits > &, const param_type &); template<typename CharT, typename Traits> CharT, Traits > & (CharT, Traits > &, const param_type &); bool (const param_type &, const param_type &); bool (const param_type &, const param_type &); }; // construct/copy/destruct (const RealType & = , const RealType & = ); (const param_type &); // public member functions RealType () ; RealType () ; RealType () ; RealType () ; param_type () ; void (const param_type &); void (); template<typename Engine> (Engine &); template<typename URNG> (URNG &, const param_type &); // friend functions template<typename CharT, typename Traits> CharT, Traits > & (CharT, Traits > &, const normal_distribution &); template<typename CharT, typename Traits> CharT, Traits > & (CharT, Traits > &, const normal_distribution &); bool (const normal_distribution &, const normal_distribution &); bool (const normal_distribution &, const normal_distribution &); };
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(const RealType & mean = , const RealType & sigma = );
Constructs a
object. normal_distribution
mean
and sigma
are the parameters for the distribution.
Requires: sigma >= 0
(const param_type & param);
Constructs a
object from its parameters. normal_distribution
normal_distribution
public member functionsRealType () ;
Returns the mean of the distribution.
RealType () ;
Returns the standard deviation of the distribution.
RealType () ;
Returns the smallest value that the distribution can produce.
RealType () ;
Returns the largest value that the distribution can produce.
param_type () ;
Returns the parameters of the distribution.
void (const param_type & param);
Sets the parameters of the distribution.
void ();
Effects: Subsequent uses of the distribution do not depend on values produced by any engine prior to invoking reset.
template<typename Engine> (Engine & eng);
Returns a normal variate.
template<typename URNG> (URNG & urng, const param_type & param);
Returns a normal variate with parameters specified by param
.
normal_distribution
friend functionstemplate<typename CharT, typename Traits> CharT, Traits > & (CharT, Traits > & os, const normal_distribution & nd);
Writes a
to a normal_distribution
std::ostream
.
template<typename CharT, typename Traits> CharT, Traits > & (CharT, Traits > & is, const normal_distribution & nd);
Reads a
from a normal_distribution
std::istream
.
bool (const normal_distribution & lhs, const normal_distribution & rhs);
Returns true if the two instances of
will return identical sequences of values given equal generators. normal_distribution
bool (const normal_distribution & lhs, const normal_distribution & rhs);
Returns true if the two instances of
will return different sequences of values given equal generators. normal_distribution