Boost logo

Boost :

From: Cromwell Enage (sponage_at_[hidden])
Date: 2004-06-22 22:05:10

--- Oliver Kullmann <O.Kullmann_at_[hidden]> wrote:
> The problem with the "very quick start" is, that
> without already understanding the architecture of
> the library it seems impossible to understand it.

Actually, there was a major change in the library
architecture between boost versions 1.30 and 1.31.
The change had to do with conformance to the WG21
specification, available at this link:


> It should be quite a bit longer, with output and
> some explanations.

The main page also provides a link to a working
program, random_demo.cpp, with quite a bit more
detailed comments than what I've already provided.

> > boost::variate_generator<BaseRNG&,UniformDist>
> > your_generator(rng, dist);
> >
> > Note the ampersand; your program will fail
> > silently if you omit it.
> I don't understand the need for the reference type
> --- otherwise the object rng would be copied, which
> should also be alright?!

Nope. Withoout the reference type, a call like:

  int random_number = your_generator();

would invoke the constructor instead of the () member
operator; hence, the silent failure.

> Perhaps one should emphasise, that models of
> pseudo-random generators are models of uniform
> random generators,

Yes, it says so in the concept documentation, which
the reader is told to look at first, although the
"emphasis" is rather weak, IMHO.

> and that also for example uniform_int yields a model
> of a uniform random generator.

Not quite. uniform_int models a uniform distribution
over which random number generators should generate
random numbers. variate_generator is the front-end
number generator that applies the distribution
constraint to the base random number generator.

> Inclusion of something like the above explanations
> into the documentation would already help a lot!

Ideally, it would be so. The problem here is when
Jens Maurer will find the time; presumably he's also
working on improving the above-mentioned WG21 spec and
preparing for the upcoming 1.32 release.

                              Cromwell Enage

Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.

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