John Maddock writes:
Um, argument to the quantile function surely?
Oops, yes, the quantile function.
I eventually found what I was looking for in some code written by
Joaquín M López Muñoz.
For the sake of closure, here is an example:
//Generate a Poisson-distributed random variate given a
//specific mean value):
#include
#include
#include
#include
#include
#include
#include <iostream>
using namespace std;
using namespace boost::random;
int main()
{
double lambda(10); //mean of Poisson distr
boost::mt19937 rnd_gen; //Mersenne Twister generator
typedef boost::variate_generator<
boost::mt19937, boost::poisson_distribution<>
> rnd_poisson_t;
rnd_poisson_t rnd_poisson( rnd_gen,
boost::poisson_distribution<>( lambda ));
rnd_poisson = rnd_poisson_t( rnd_gen,
boost::poisson_distribution<>( lambda ));
cout << "\nFive Poisson-distributed random numbers\n";
for(int i = 0; i < 5; i++) {
cout << rnd_poisson() << endl;
}
return 0;
}