Boost
C++ Libraries
...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
This is an older version of Boost and was released in 2013. The current version is 1.90.0.
<boost/random.hpp>
namespace boost {
template<class UniformRandomNumberGenerator, class IntType = long>
class random_number_generator;
template<class Generator>
class generator_iterator;
} // namespace boost
random_number_generator
template<class UniformRandomNumberGenerator, class IntType = long>
class random_number_generator
{
public:
typedef UniformRandomNumberGenerator base_type;
typedef IntType argument_type;
typedef IntType result_type;
random_number_generator(base_type & rng);
result_type operator()(argument_type n);
};
random_number_generator
model a RandomNumberGenerator (std:25.2.11 [lib.alg.random.shuffle]).
On each invocation, it returns a uniformly distributed integer in
the range [0..n).
The template parameter IntType shall denote some
integer-like value type.
Note: I consider it unfortunate that the C++ Standard uses the name RandomNumberGenerator for something rather specific.
random_number_generator(base_type & rng)Effects: Constructs a
random_number_generator functor with the given uniform
random number generator as the underlying source of random numbers.
result_type operator()(argument_type n)Returns: The value of
uniform_int<base_type>(rng, 0, n-1)().
Jens Maurer, 2001-11-19