Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Class template random_number_generator

boost::random::random_number_generator

Synopsis

// In header: <boost/random/random_number_generator.hpp>

template<typename URNG, typename IntType = long> 
class random_number_generator {
public:
  // types
  typedef URNG    base_type;    
  typedef IntType argument_type;
  typedef IntType result_type;  

  // construct/copy/destruct
  random_number_generator(base_type &);

  // public member functions
  result_type operator()(argument_type);
};

Description

Instantiations of class template 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.

random_number_generator public construct/copy/destruct

  1. random_number_generator(base_type & rng);

    Constructs a random_number_generator functor with the given uniform random number generator as the underlying source of random numbers.

random_number_generator public member functions

  1. result_type operator()(argument_type n);

    Returns a value in the range [0, n)


PrevUpHomeNext