Boost logo

Boost Users :

Subject: Re: [Boost-users] random: uniform_01 usage and mixing boost::random with boost::math::normal
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-02-16 09:58:20


AMDG

Hicham Mouline wrote:
> I have this code:
>
> boost::mt19937 mers;
> boost::uniform_01<boost::mt19937> uf01(mers);
> boost::exponential_distribution<> ed(0.1);
>
> I call the operator() on uf01 3 million times, as
> uf01()
>
> I don't quite understand the warning in the documentation about the
> constructor taking the generator by value.
> This means that my mers doesn't change between calls to uf01().
> Is this bad? Will it affect the quality of the randomness of the uniform
> numbers generated?
>

If /all/ you do with the generator is to use it in a single
boost::uniform_01, then it doesn't matter. If you use the
generator for anything else, then you'll get the same
sequence multiple times, which is probably bad.

> I also have
> boost::math::normal nrm;
> and I use
> boost::math::cdf(nrm, ¡­)
> and
> boost::math::quantile( nrm, ¡­ );
>
> Are there any issues with using both boost¡Ëmath¡Ënormal and other
> distributions from the boost¡Ërandom library?
>

I don't think so.

In Christ,
Steven Watanabe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net