Files
2025-10-25 03:02:53 +03:00

14 KiB
Raw Permalink Blame History

[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]

1

#

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);

2

#

Preconditions: 0<mean.

3

#

Remarks: mean corresponds to the parameter of the distribution.

🔗

double mean() const;

4

#

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]

1

#

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);

2

#

Preconditions: 0<lambda.

3

#

Remarks: lambda corresponds to the parameter of the distribution.

🔗

RealType lambda() const;

4

#

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]

1

#

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);

2

#

Preconditions: 0<alpha and 0<beta.

3

#

Remarks: alpha and beta correspond to the parameters of the distribution.

🔗

RealType alpha() const;

4

#

Returns: The value of the alpha parameter with which the object was constructed.

🔗

RealType beta() const;

5

#

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]

1

#

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−‹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);

2

#

Preconditions: 0<a and 0<b.

3

#

Remarks: a and b correspond to the respective parameters of the distribution.

🔗

RealType a() const;

4

#

Returns: The value of the a parameter with which the object was constructed.

🔗

RealType b() const;

5

#

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]

1

#

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);

2

#

Preconditions: 0<b.

3

#

Remarks: a and b correspond to the respective parameters of the distribution.

🔗

RealType a() const;

4

#

Returns: The value of the a parameter with which the object was constructed.

🔗

RealType b() const;

5

#

Returns: The value of the b parameter with which the object was constructed.

246)246)

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.