Reputation: 3
I'm trying to generate random number using Rayleigh distribution. I have implemented this using the c++ the library below:
#include <boost/math/distributions/rayleigh.hpp>
boost::math::rayleigh_distribution<> rayleigh();
I don't know how to use this library to return number related to sigma
.
Upvotes: 0
Views: 415
Reputation:
The sigma is passed in the constructor, so do it like this:
const double sigma = 5.;
boost::math::rayleigh_distribution<> rayleigh(sigma);
The method sigma() merely returns a copy of the set sigma, so you cannot use that.
What Scheff was referring to is that it would also work (given you want sigma to be 1.) if you do that
boost::math::rayleigh_distribution<> rayleigh{};
as this has no ambiguity with a function declaration, but is setting sigma to 1.
Upvotes: 1