...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::cauchy_distribution
// In header: <boost/random/cauchy_distribution.hpp> template<typename RealType = double> class cauchy_distribution { public: // types typedef RealType input_type; typedef RealType result_type; // construct/copy/destruct cauchy_distribution(result_type = result_type(0), result_type = result_type(1)); // public member functions result_type median() const; result_type sigma() const; void reset(); template<typename Engine> result_type operator()(Engine &); // friend functions template<typename CharT, typename Traits> friend std::basic_ostream< CharT, Traits > & operator<<(std::basic_ostream< CharT, Traits > &, const cauchy_distribution &); template<typename CharT, typename Traits> friend std::basic_istream< CharT, Traits > & operator>>(std::basic_istream< CharT, Traits > &, cauchy_distribution &); };
The cauchy distribution is a continuous distribution with two parameters, sigma and median.
It has
cauchy_distribution
public
construct/copy/destructcauchy_distribution(result_type median_arg = result_type(0), result_type sigma_arg = result_type(1));
Constructs a cauchy_distribution
with the paramters median
and sigma
.
cauchy_distribution
public member functionsresult_type median() const;
Returns: the "median" parameter of the distribution
result_type sigma() const;
Returns: the "sigma" parameter of the distribution
void reset();
Effects: Subsequent uses of the distribution do not depend on values produced by any engine prior to invoking reset.
template<typename Engine> result_type operator()(Engine & eng);
Returns: A random variate distributed according to the cauchy distribution.
cauchy_distribution
friend functionstemplate<typename CharT, typename Traits> friend std::basic_ostream< CharT, Traits > & operator<<(std::basic_ostream< CharT, Traits > & os, const cauchy_distribution & cd);
Writes the parameters of the distribution to a std::ostream
.
template<typename CharT, typename Traits> friend std::basic_istream< CharT, Traits > & operator>>(std::basic_istream< CharT, Traits > & is, cauchy_distribution & cd);
Reads the parameters of the distribution from a std::istream
.