
31 Mar
2009
31 Mar
'09
1:52 a.m.
AMDG Barco You wrote:
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?
Did you try calling g() multiple times? The default constructor of boost::mt19937 puts it in a fixed state, so the sequence of numbers which it generates will always be the same. In Christ, Steven Watanabe