Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2008-07-16 05:28:48


Michael Fuller wrote:
> I've searched the Boost documentation and mail archive, but I can't
> find an example for extracting a random variate from a Poisson
> distribution. What I want to do is similar to extracting a variate
> from a uniform distribution, such as the C++ rand() function, which
> returns a single random variate on the range [0, RAND_MAX].
>
> Is there a way to do something similar using the Poisson distribution
> with a given mean? For example, something like this:
>
> double n, lambda(0.30); //lambda is the mean of the Poisson
> n = poisson_rand(lambda);

Try boost/random/poisson_distribution.hpp, unfortunately appears not to be
documented, but usage is the same as the other distributions in
Boost.Random.

HTH, John.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net