Home Libraries People FAQ More

#### Random Variates and Distribution Parameters

Random variates and distribution parameters are conventionally distinguished (for example in Wikipedia and Wolfram MathWorld by placing a semi-colon after the random variate (whose value you 'choose'), to separate the variate from the parameter(s) that defines the shape of the distribution.

For example, the binomial distribution has two parameters: n (the number of trials) and p (the probability of success on one trial). It also has the random variate k: the number of successes observed. This means the probability density/mass function (pdf) is written as f(k; n, p).

Translating this into code the `binomial_distribution` constructor therefore has two parameters:

```binomial_distribution(RealType n, RealType p);
```

While the function `pdf` has one argument specifying the distribution type (which includes it's parameters, if any), and a second argument for the random variate. So taking our binomial distribution example, we would write:

```pdf(binomial_distribution<RealType>(n, p), k);
```
 Copyright © 2006 -2007 John Maddock, Paul A. Bristow, Hubert Holin and Xiaogang Zhang Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)