
Hi Mathias, I did as you instructed. double p = 0.5; boost::mt19937 rng; boost::bernoulli_distribution<
d(p); boost::variate_generator< boost::mt19937&, boost::bernoulli_distribution<> > g(rng, d);
double x = g();
But I got always 0 for x, why? ---- Best regards, Barco On Mon, Mar 30, 2009 at 9:46 PM, Mathias Gaunard < mathias.gaunard@ens-lyon.org> wrote:
Barco You wrote:
I want to randomly generate a Bernuolli number [0, 1],with probability p
~[0 1]. How to do that with boost?
From reading the boost.random documentation for a minute, I came up with this:
double p = ???;
boost::mt19937 rng; boost::bernoulli_distribution<> d(p); boost::variate_generator< boost::mt19937&, boost::bernoulli_distribution<> > g(rng, d);
double x = g();
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
-- ------------------------------- Enjoy life! Barco You