Boost logo

Boost :

Subject: Re: [boost] How to generate a Bernuolli number
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2009-03-30 09:46:57

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);
> g(rng, d);

double x = g();

Boost list run by bdawes at, gregod at, cpdaniel at, john at