Opened 13 years ago

Closed 13 years ago

#3451 closed Bugs (fixed)

Poisson generator not mentioned in documentation

Reported by: mazzucco@… Owned by: No-Maintainer
Milestone: Boost 1.41.0 Component: random
Version: Boost 1.40.0 Severity: Problem
Keywords: Cc:

Description

The Poisson generator not mentioned in the documentation, although it appears to be there and working.

Change History (3)

comment:1 by ts337@…, 13 years ago

As far as I can tell, the following lines of code should work, but don't:

boost::mt19937 rng(3u); boost::poisson_distribution<> po_dist(0.7); cout <<"Po var: " << po_dist(rng)<<endl;

As far as I can tell, poisson_distribution::operator()(Engine& eng) results in an infinite loop.

So should probably be fixed before documenting?

comment:2 by Steven Watanabe, 13 years ago

The poisson distribution takes a random number engine that produces values in the range [0, 1). You need to use variate_generator.

#include <boost/random.hpp>
#include <iostream>

int main() {
    boost::mt19937 rng(3u);
    boost::variate_generator<boost::mt19937&, boost::poisson_distribution<> >
        po_dist(rng, boost::poisson_distribution<>(0.7));
    std::cout << "Po var: " << po_dist() << std::endl; 
}

comment:3 by Steven Watanabe, 13 years ago

Resolution: fixed
Status: newclosed

The Poisson distribution is now documented.

Note: See TracTickets for help on using tickets.