|
Boost : |
Subject: Re: [boost] How to generate a Bernuolli number
From: Barco You (barcojie_at_[hidden])
Date: 2009-03-31 02:06:02
Hi Steven,
Fine now!
Thanks a lot!
On Tue, Mar 31, 2009 at 11:11 AM, Steven Watanabe <watanabesj_at_[hidden]>wrote:
> AMDG
>
> Barco You wrote:
>
>> I call it 1000 time, and all output is 0.
>>
>>
>
> Works for me...
>
> #include <boost/random.hpp>
> #include <iostream>
>
> int main() {
> double p = 0.5;
> boost::mt19937 rng;
> boost::bernoulli_distribution<> d(p);
> boost::variate_generator<
> boost::mt19937&,
> boost::bernoulli_distribution<>
> > g(rng, d);
>
> for(int i = 0; i < 10; ++i) {
> std::cout << g() << std::endl;
>
> }
> }
>
> In Christ,
> Steven Watanabe
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>
-- ------------------------------- Enjoy life! Barco You
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk