Boost logo

Boost :

From: Matthias Troyer (troyer_at_[hidden])
Date: 2003-12-31 04:40:14

On Dec 29, 2003, at 11:19 PM, Jens Maurer wrote:
> Matthias Troyer wrote:
>>> Here is a test program that fails to compile now:
>>> #include <boost/random.hpp>
>>> int main()
>>> {
>>> boost::lagged_fibonacci607 rng;
>>> boost::uniform_int<> int_rng(0,3);
>>> int x = int_rng(rng);
>>> }
> The proper test program now looks like this:
> boost::lagged_fibonacci607 rng;
> boost::uniform_int<> int_rng(0,3);
> boost::variate_generator<boost::lagged_fibonacci607&,
> boost::uniform_int<> > uni(rng, int_rng);
> int x = uni();
> See libs/random/random_demo.cpp
> Please tell me where the documentation still refers to the old format.

Hi Jens,

I was aware of the new way to use boost random, but that was not
consistent with the documentation. Look at random-distributions.html.
First you declare uniform_int in the synopsis as:

  template<class UniformRandomNumberGenerator, class IntType = int>
   class uniform_int;

Later it is defined differently as:

template<class IntType = int>
class uniform_int
   typedef IntType input_type;
   typedef IntType result_type;
   static const bool has_fixed_range = false;
   explicit uniform_int(IntType min = 0, IntType max = 9);
   result_type min() const;
   result_type max() const;
   void reset();
   template<class UniformRandomNumberGenerator>
   result_type operator()(UniformRandomNumberGenerator& urng);
   template<class UniformRandomNumberGenerator>
   result_type operator()(UniformRandomNumberGenerator& urng,
result_type n);

Besides the small change to the overall synopsis, the documentation of
the distribution seems incorrect. The above test program (which I know
is not your intended way of using the library) would be correct
according to the documentation: I'm passing a
UniformRandomNumberGenerator to operator(). Since this fails to compile
and you tell us that this is not the intended use, I would appreciate
an updated documentation.

Best regards


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