14 KiB
[rand.dist.pois]
29 Numerics library [numerics]
29.5 Random number generation [rand]
29.5.9 Random number distribution class templates [rand.dist]
29.5.9.4 Poisson distributions [rand.dist.pois]
29.5.9.4.1 Class template poisson_distribution [rand.dist.pois.poisson]
A poisson_distribution random number distribution produces integer values i ⥠0 distributed according to the discrete probability function in Formula 29.8.
P(i|μ)=eâμμii!(29.8)
The distribution parameter μ is also known as this distribution's mean.
namespace std {templateclass poisson_distribution {public:// typesusing result_type = IntType; using param_type = unspecified; // constructors and reset functions poisson_distribution() : poisson_distribution(1.0) {}explicit poisson_distribution(double mean); explicit poisson_distribution(const param_type& parm); void reset(); // equality operatorsfriend bool operator==(const poisson_distribution& x, const poisson_distribution& y); // generating functionstemplate result_type operator()(URBG& g); template result_type operator()(URBG& g, const param_type& parm); // property functionsdouble mean() const; param_type param() const; void param(const param_type& parm); result_type min() const; result_type max() const; // inserters and extractorstemplate<class charT, class traits>friend basic_ostream<charT, traits>&operator<<(basic_ostream<charT, traits>& os, const poisson_distribution& x); template<class charT, class traits>friend basic_istream<charT, traits>&operator>>(basic_istream<charT, traits>& is, poisson_distribution& x); };}
explicit poisson_distribution(double mean);
Preconditions: 0<mean.
Remarks: mean corresponds to the parameter of the distribution.
double mean() const;
Returns: The value of the mean parameter with which the object was constructed.
29.5.9.4.2 Class template exponential_distribution [rand.dist.pois.exp]
An exponential_distribution random number distribution produces random numbers x>0 distributed according to the probability density function in Formula 29.9.
p(x|λ)=λeâλx(29.9)
namespace std {templateclass exponential_distribution {public:// typesusing result_type = RealType; using param_type = unspecified; // constructors and reset functions exponential_distribution() : exponential_distribution(1.0) {}explicit exponential_distribution(RealType lambda); explicit exponential_distribution(const param_type& parm); void reset(); // equality operatorsfriend bool operator==(const exponential_distribution& x, const exponential_distribution& y); // generating functionstemplate result_type operator()(URBG& g); template result_type operator()(URBG& g, const param_type& parm); // property functions RealType lambda() const; param_type param() const; void param(const param_type& parm); result_type min() const; result_type max() const; // inserters and extractorstemplate<class charT, class traits>friend basic_ostream<charT, traits>&operator<<(basic_ostream<charT, traits>& os, const exponential_distribution& x); template<class charT, class traits>friend basic_istream<charT, traits>&operator>>(basic_istream<charT, traits>& is, exponential_distribution& x); };}
explicit exponential_distribution(RealType lambda);
Preconditions: 0<lambda.
Remarks: lambda corresponds to the parameter of the distribution.
RealType lambda() const;
Returns: The value of the lambda parameter with which the object was constructed.
29.5.9.4.3 Class template gamma_distribution [rand.dist.pois.gamma]
A gamma_distribution random number distribution produces random numbers x>0 distributed according to the probability density function in Formula 29.10.
p(x|α,β)=eâx/ββαâÎ(α)âxαâ1(29.10)
namespace std {templateclass gamma_distribution {public:// typesusing result_type = RealType; using param_type = unspecified; // constructors and reset functions gamma_distribution() : gamma_distribution(1.0) {}explicit gamma_distribution(RealType alpha, RealType beta = 1.0); explicit gamma_distribution(const param_type& parm); void reset(); // equality operatorsfriend bool operator==(const gamma_distribution& x, const gamma_distribution& y); // generating functionstemplate result_type operator()(URBG& g); template result_type operator()(URBG& g, const param_type& parm); // property functions RealType alpha() const; RealType beta() const; param_type param() const; void param(const param_type& parm); result_type min() const; result_type max() const; // inserters and extractorstemplate<class charT, class traits>friend basic_ostream<charT, traits>&operator<<(basic_ostream<charT, traits>& os, const gamma_distribution& x); template<class charT, class traits>friend basic_istream<charT, traits>&operator>>(basic_istream<charT, traits>& is, gamma_distribution& x); };}
explicit gamma_distribution(RealType alpha, RealType beta = 1.0);
Preconditions: 0<alpha and 0<beta.
Remarks: alpha and beta correspond to the parameters of the distribution.
RealType alpha() const;
Returns: The value of the alpha parameter with which the object was constructed.
RealType beta() const;
Returns: The value of the beta parameter with which the object was constructed.
29.5.9.4.4 Class template weibull_distribution [rand.dist.pois.weibull]
A weibull_distribution random number distribution produces random numbers x ⥠0 distributed according to the probability density function in Formula 29.11.
p(x|a,b)=abâ(xb)aâ1âexp(â(xb)a)(29.11)
namespace std {templateclass weibull_distribution {public:// typesusing result_type = RealType; using param_type = unspecified; // constructor and reset functions weibull_distribution() : weibull_distribution(1.0) {}explicit weibull_distribution(RealType a, RealType b = 1.0); explicit weibull_distribution(const param_type& parm); void reset(); // equality operatorsfriend bool operator==(const weibull_distribution& x, const weibull_distribution& y); // generating functionstemplate result_type operator()(URBG& g); template result_type operator()(URBG& g, const param_type& parm); // property functions RealType a() const; RealType b() const; param_type param() const; void param(const param_type& parm); result_type min() const; result_type max() const; // inserters and extractorstemplate<class charT, class traits>friend basic_ostream<charT, traits>&operator<<(basic_ostream<charT, traits>& os, const weibull_distribution& x); template<class charT, class traits>friend basic_istream<charT, traits>&operator>>(basic_istream<charT, traits>& is, weibull_distribution& x); };}
explicit weibull_distribution(RealType a, RealType b = 1.0);
Preconditions: 0<a and 0<b.
Remarks: a and b correspond to the respective parameters of the distribution.
RealType a() const;
Returns: The value of the a parameter with which the object was constructed.
RealType b() const;
Returns: The value of the b parameter with which the object was constructed.
29.5.9.4.5 Class template extreme_value_distribution [rand.dist.pois.extreme]
An extreme_value_distribution random number distribution produces random numbers x distributed according to the probability density function in Formula 29.12.246
p(x|a,b)=1bâexp(aâxbâexp(aâxb))(29.12)
namespace std {templateclass extreme_value_distribution {public:// typesusing result_type = RealType; using param_type = unspecified; // constructor and reset functions extreme_value_distribution() : extreme_value_distribution(0.0) {}explicit extreme_value_distribution(RealType a, RealType b = 1.0); explicit extreme_value_distribution(const param_type& parm); void reset(); // equality operatorsfriend bool operator==(const extreme_value_distribution& x, const extreme_value_distribution& y); // generating functionstemplate result_type operator()(URBG& g); template result_type operator()(URBG& g, const param_type& parm); // property functions RealType a() const; RealType b() const; param_type param() const; void param(const param_type& parm); result_type min() const; result_type max() const; // inserters and extractorstemplate<class charT, class traits>friend basic_ostream<charT, traits>&operator<<(basic_ostream<charT, traits>& os, const extreme_value_distribution& x); template<class charT, class traits>friend basic_istream<charT, traits>&operator>>(basic_istream<charT, traits>& is, extreme_value_distribution& x); };}
explicit extreme_value_distribution(RealType a, RealType b = 1.0);
Preconditions: 0<b.
Remarks: a and b correspond to the respective parameters of the distribution.
RealType a() const;
Returns: The value of the a parameter with which the object was constructed.
RealType b() const;
Returns: The value of the b parameter with which the object was constructed.
The distribution corresponding to this probability density function is also known (with a possible change of variable) as the Gumbel Type I, the log-Weibull, or the Fisher-Tippett Type I distribution.