Boost logo

Boost :

From: Richard Peters (r.a.peters_at_[hidden])
Date: 2004-06-24 04:31:10

Every time when I used the random number library, I was wondering why I
needed variate_generator. The existence of variate_generator made me feel
like I had to use it, because I thought that other uses of the library (like
passing the generator as an argument to the distribution) were undocumented,
and could therefore be changed in next versions of the library.
variate_generator looks like some sort of glue with virtually the same
functionality that bind provides, but it still wasn't clear to me why I
needed to use variate_generator instead of passing the generator as argument
to the distribution. The wg21 proposal gives a few reasons why
variate_generator could be useful, and although I haven't read it
thoroughly, I'm getting the inpression that variate_generator is only useful
in some specific cases. In the way I normally use random number generators,
it suffices to pass the generator as argument to the distribution. If a
generator (as in, a function taking 0 parameters) is needed, bind could
provide the desired functionality.
Would it therefore not be a good idea to make this clear in the
documentation, by stating that normally the generator can be passed as an
argument to the distribution, and treating variate_generator in a separate
documentation section where the first few lines explain when
variate_generator gives you more functionality than using the direct
approach or using bind?
Of course, if I'm wrong in stating that variate_generator isn't actually
required to make use of the random number library, please tell me.

best regards,

Richard Peters

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