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 the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Class template random_t

boost::unit_test::data::monomorphic::random_t — Generator for the random sequences.

Synopsis

// In header: <boost/test/data/monomorphic/generators/random.hpp>

template<typename SampleType = double, 
         typename DistributionType = typename ds_detail::default_distribution<SampleType>::type, 
         typename EngineType = std::default_random_engine> 
class random_t {
public:
  // types
  typedef SampleType       sample;     
  typedef DistributionType distr_type; 
  typedef EngineType       engine_type;

  // construct/copy/destruct
  random_t();
  explicit random_t(distr_type &&);
  random_t(engine_type &&, distr_type &&);

  // public member functions
  data::size_t capacity() const;
  SampleType next();
  void reset();
  template<typename SeedType> void seed(SeedType &&);
};

Description

This class implements the generator concept (see boost::unit_test::data::monomorphic::generated_by) for implementing a random number generator.

random_t public construct/copy/destruct

  1. random_t();
  2. explicit random_t(distr_type && d);
  3. random_t(engine_type && e, distr_type && d);

random_t public member functions

  1. data::size_t capacity() const;
  2. SampleType next();
  3. void reset();
  4. template<typename SeedType> void seed(SeedType && seed);
    Sets the seed of the pseudo-random number engine.

PrevUpHomeNext