[rand.dist.pois]

# 29 Numerics library [[numerics]](./#numerics)

## 29.5 Random number generation [[rand]](rand#dist.pois)

### 29.5.9 Random number distribution class templates [[rand.dist]](rand.dist#pois)

#### 29.5.9.4 Poisson distributions [rand.dist.pois]

#### [29.5.9.4.1](#poisson) Class template poisson_distribution [[rand.dist.pois.poisson]](rand.dist.pois.poisson)

[1](#poisson-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L5157)

A poisson_distribution random number distribution
produces integer values i â¥ 0 distributed according to
the discrete probability function in Formula [29.8](#eq:rand.dist.pois.poisson)[.](#poisson-1.sentence-1)

P(i|Î¼)=eâÎ¼Î¼ii!(29.8)

The distribution parameter Î¼ is also known as this distribution's [*mean*](#def:mean)[.](#poisson-1.sentence-2)

[ð](#lib:poisson_distribution_)

namespace std {template<class IntType = int>class 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<class URBG> result_type operator()(URBG& g); template<class URBG> 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); };}

[ð](#lib:poisson_distribution,constructor)

`explicit poisson_distribution(double mean);
`

[2](#poisson-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L5218)

*Preconditions*: 0<mean[.](#poisson-2.sentence-1)

[3](#poisson-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L5222)

*Remarks*: mean corresponds to the parameter of the distribution[.](#poisson-3.sentence-1)

[ð](#lib:mean,poisson_distribution)

`double mean() const;
`

[4](#poisson-4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L5233)

*Returns*: The value of the mean parameter
 with which the object was constructed[.](#poisson-4.sentence-1)

#### [29.5.9.4.2](#exp) Class template exponential_distribution [[rand.dist.pois.exp]](rand.dist.pois.exp)

[1](#exp-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L5245)

An exponential_distribution random number distribution
produces random numbers x>0 distributed according to
the probability density function in Formula [29.9](#eq:rand.dist.pois.exp)[.](#exp-1.sentence-1)

p(x|Î»)=Î»eâÎ»x(29.9)

[ð](#lib:exponential_distribution_)

namespace std {template<class RealType = double>class 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<class URBG> result_type operator()(URBG& g); template<class URBG> 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); };}

[ð](#lib:exponential_distribution,constructor)

`explicit exponential_distribution(RealType lambda);
`

[2](#exp-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L5305)

*Preconditions*: 0<lambda[.](#exp-2.sentence-1)

[3](#exp-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L5309)

*Remarks*: lambda corresponds to the parameter of the distribution[.](#exp-3.sentence-1)

[ð](#lib:lambda,exponential_distribution)

`RealType lambda() const;
`

[4](#exp-4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L5320)

*Returns*: The value of the lambda parameter
 with which the object was constructed[.](#exp-4.sentence-1)

#### [29.5.9.4.3](#gamma) Class template gamma_distribution [[rand.dist.pois.gamma]](rand.dist.pois.gamma)

[1](#gamma-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L5332)

A gamma_distribution random number distribution
produces random numbers x>0 distributed according to
the probability density function in Formula [29.10](#eq:rand.dist.pois.gamma)[.](#gamma-1.sentence-1)

p(x|Î±,Î²)=eâx/Î²Î²Î±âÎ(Î±)âxÎ±â1(29.10)

[ð](#lib:gamma_distribution_)

namespace std {template<class RealType = double>class 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<class URBG> result_type operator()(URBG& g); template<class URBG> 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); };}

[ð](#lib:gamma_distribution,constructor)

`explicit gamma_distribution(RealType alpha, RealType beta = 1.0);
`

[2](#gamma-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L5394)

*Preconditions*: 0<alpha and 0<beta[.](#gamma-2.sentence-1)

[3](#gamma-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L5398)

*Remarks*: alpha and beta correspond to the parameters of the distribution[.](#gamma-3.sentence-1)

[ð](#lib:alpha,gamma_distribution)

`RealType alpha() const;
`

[4](#gamma-4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L5410)

*Returns*: The value of the alpha parameter
 with which the object was constructed[.](#gamma-4.sentence-1)

[ð](#lib:beta,gamma_distribution)

`RealType beta() const;
`

[5](#gamma-5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L5422)

*Returns*: The value of the beta parameter
 with which the object was constructed[.](#gamma-5.sentence-1)

#### [29.5.9.4.4](#weibull) Class template weibull_distribution [[rand.dist.pois.weibull]](rand.dist.pois.weibull)

[1](#weibull-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L5435)

A weibull_distribution random number distribution
produces random numbers x â¥ 0 distributed according to
the probability density function in Formula [29.11](#eq:rand.dist.pois.weibull)[.](#weibull-1.sentence-1)

p(x|a,b)=abâ(xb)aâ1âexp(â(xb)a)(29.11)

[ð](#lib:weibull_distribution_)

namespace std {template<class RealType = double>class 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<class URBG> result_type operator()(URBG& g); template<class URBG> 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); };}

[ð](#lib:weibull_distribution,constructor)

`explicit weibull_distribution(RealType a, RealType b = 1.0);
`

[2](#weibull-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L5497)

*Preconditions*: 0<a and 0<b[.](#weibull-2.sentence-1)

[3](#weibull-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L5501)

*Remarks*: a and b correspond to the respective parameters of the distribution[.](#weibull-3.sentence-1)

[ð](#lib:a,weibull_distribution)

`RealType a() const;
`

[4](#weibull-4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L5513)

*Returns*: The value of the a parameter
 with which the object was constructed[.](#weibull-4.sentence-1)

[ð](#lib:b,weibull_distribution)

`RealType b() const;
`

[5](#weibull-5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L5525)

*Returns*: The value of the b parameter
 with which the object was constructed[.](#weibull-5.sentence-1)

#### [29.5.9.4.5](#extreme) Class template extreme_value_distribution [[rand.dist.pois.extreme]](rand.dist.pois.extreme)

[1](#extreme-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L5538)

An extreme_value_distribution random number distribution
produces random numbers x distributed according to
the probability density function in Formula [29.12](#eq:rand.dist.pois.extreme)[.](#extreme-1.sentence-1)[246](#footnote-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.")

p(x|a,b)=1bâexp(aâxbâexp(aâxb))(29.12)

[ð](#lib:extreme_value_distribution_)

namespace std {template<class RealType = double>class 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<class URBG> result_type operator()(URBG& g); template<class URBG> 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); };}

[ð](#lib:extreme_value_distribution,constructor)

`explicit extreme_value_distribution(RealType a, RealType b = 1.0);
`

[2](#extreme-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L5610)

*Preconditions*: 0<b[.](#extreme-2.sentence-1)

[3](#extreme-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L5614)

*Remarks*: a and b correspond to the respective parameters of the distribution[.](#extreme-3.sentence-1)

[ð](#lib:a,extreme_value_distribution)

`RealType a() const;
`

[4](#extreme-4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L5626)

*Returns*: The value of the a parameter
 with which the object was constructed[.](#extreme-4.sentence-1)

[ð](#lib:b,extreme_value_distribution)

`RealType b() const;
`

[5](#extreme-5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L5638)

*Returns*: The value of the b parameter
 with which the object was constructed[.](#extreme-5.sentence-1)

[246)](#footnote-246)[246)](#footnoteref-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[.](#footnote-246.sentence-1)
