...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::random::lognormal_distribution
// In header: <boost/random/lognormal_distribution.hpp> template<typename RealType = double> class lognormal_distribution { public: // types typedef normal_distribution< RealType >::input_type input_type; typedef RealType result_type; // member classes/structs/unions class param_type { public: // types typedef lognormal_distribution distribution_type; // public member functions explicit param_type(RealType = 0.0, RealType = 1.0); RealType m() const; RealType s() const; // friend functions template<typename CharT, typename Traits> std::basic_ostream< CharT, Traits > & operator<<(std::basic_ostream< CharT, Traits > &, const param_type &); template<typename CharT, typename Traits> std::basic_istream< CharT, Traits > & operator>>(std::basic_istream< CharT, Traits > &, const param_type &); bool operator==(const param_type &, const param_type &); bool operator!=(const param_type &, const param_type &); }; // public member functions explicit lognormal_distribution(RealType = 0.0, RealType = 1.0); explicit lognormal_distribution(const param_type &); RealType m() const; RealType s() const; RealType min() const; RealType max() const; param_type param() const; void param(const param_type &); void reset(); template<typename Engine> result_type operator()(Engine &); template<typename Engine> result_type operator()(Engine &, const param_type &); // friend functions template<typename CharT, typename Traits> std::basic_ostream< CharT, Traits > & operator<<(std::basic_ostream< CharT, Traits > &, const lognormal_distribution &); template<typename CharT, typename Traits> std::basic_istream< CharT, Traits > & operator>>(std::basic_istream< CharT, Traits > &, const lognormal_distribution &); bool operator==(const lognormal_distribution &, const lognormal_distribution &); bool operator!=(const lognormal_distribution &, const lognormal_distribution &); };
Instantiations of class template lognormal_distribution model a random distribution . Such a distribution produces random numbers with for x > 0.
Warning | |
---|---|
This distribution has been updated to match the C++ standard. Its behavior has changed from the original boost::lognormal_distribution. A backwards compatible version is provided in namespace boost. |
lognormal_distribution
public member functionsexplicit lognormal_distribution(RealType m = 0.0, RealType s = 1.0);
Constructs a lognormal_distribution. m
and s
are the parameters of the distribution.
explicit lognormal_distribution(const param_type & param);
Constructs a lognormal_distribution from its parameters.
RealType m() const;
Returns the m parameter of the distribution.
RealType s() const;
Returns the s parameter of the distribution.
RealType min() const;
Returns the smallest value that the distribution can produce.
RealType max() const;
Returns the largest value that the distribution can produce.
param_type param() const;
Returns the parameters of the distribution.
void param(const param_type & param);
Sets the parameters 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 lognormal distribution.
template<typename Engine> result_type operator()(Engine & eng, const param_type & param);
Returns a random variate distributed according to the lognormal distribution with parameters specified by param.
lognormal_distribution
friend functionstemplate<typename CharT, typename Traits> std::basic_ostream< CharT, Traits > & operator<<(std::basic_ostream< CharT, Traits > & os, const lognormal_distribution & ld);
Writes the distribution to a std::ostream
.
template<typename CharT, typename Traits> std::basic_istream< CharT, Traits > & operator>>(std::basic_istream< CharT, Traits > & is, const lognormal_distribution & ld);
Reads the distribution from a std::istream
.
bool operator==(const lognormal_distribution & lhs, const lognormal_distribution & rhs);
Returns true if the two distributions will produce identical sequences of values given equal generators.
bool operator!=(const lognormal_distribution & lhs, const lognormal_distribution & rhs);
Returns true if the two distributions may produce different sequences of values given equal generators.