Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::random::additive_combine_engine< MLCG1, MLCG2 > Class Template Reference

An instantiation of class template additive_combine_engine models a . More...

#include <additive_combine.hpp>

Public Types

typedef MLCG1 first_base
 
typedef MLCG2 second_base
 
typedef MLCG1::result_type result_type
 

Public Member Functions

 BOOST_STATIC_CONSTANT (bool, has_fixed_range=false)
 
 additive_combine_engine ()
 Constructs an additive_combine_engine using the default constructors of the two base generators. More...
 
 BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR (additive_combine_engine, result_type, seed_arg)
 Constructs an additive_combine_engine, using seed as the constructor argument for both base generators. More...
 
 BOOST_RANDOM_DETAIL_SEED_SEQ_CONSTRUCTOR (additive_combine_engine, SeedSeq, seq)
 Constructs an additive_combine_engine, using seq as the constructor argument for both base generators. More...
 
 additive_combine_engine (typename MLCG1::result_type seed1, typename MLCG2::result_type seed2)
 Constructs an additive_combine_engine, using seed1 and seed2 as the constructor argument to the first and second base generators, respectively. More...
 
template<class It >
 additive_combine_engine (It &first, It last)
 Contructs an additive_combine_engine with values from the range defined by the input iterators first and last. More...
 
void seed ()
 Seeds an additive_combine_engine using the default seeds of the two base generators. More...
 
 BOOST_RANDOM_DETAIL_ARITHMETIC_SEED (additive_combine_engine, result_type, seed_arg)
 Seeds an additive_combine_engine, using seed as the seed for both base generators. More...
 
 BOOST_RANDOM_DETAIL_SEED_SEQ_SEED (additive_combine_engine, SeedSeq, seq)
 Seeds an additive_combine_engine, using seq to seed both base generators. More...
 
void seed (typename MLCG1::result_type seed1, typename MLCG2::result_type seed2)
 Seeds an additive_combine generator, using seed1 and seed2 as the seeds to the first and second base generators, respectively. More...
 
template<class It >
void seed (It &first, It last)
 Seeds an additive_combine_engine with values from the range defined by the input iterators first and last. More...
 
result_type operator() ()
 Returns the next value of the generator. More...
 
template<class Iter >
void generate (Iter first, Iter last)
 Fills a range with random values. More...
 
void discard (boost::uintmax_t z)
 Advances the state of the generator by z. More...
 
 BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR (os, additive_combine_engine, r)
 Writes the state of an additive_combine_engine to a std::ostream. More...
 
 BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR (is, additive_combine_engine, r)
 Reads the state of an additive_combine_engine from a std::istream. More...
 
 BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR (additive_combine_engine, x, y)
 Returns: true iff the two additive_combine_engines will produce the same sequence of values. More...
 

Static Public Member Functions

static result_type min BOOST_PREVENT_MACRO_SUBSTITUTION ()
 Returns the smallest value that the generator can produce. More...
 
static result_type max BOOST_PREVENT_MACRO_SUBSTITUTION ()
 Returns the largest value that the generator can produce. More...
 

Detailed Description

template<class MLCG1, class MLCG2>
class boost::random::additive_combine_engine< MLCG1, MLCG2 >

An instantiation of class template additive_combine_engine models a .

It combines two multiplicative number generators, i.e. those with c = 0. It is described in

"Efficient and Portable Combined Random Number Generators", Pierre L'Ecuyer, Communications of the ACM, Vol. 31, No. 6, June 1988, pp. 742-749, 774

The template parameters MLCG1 and MLCG2 shall denote two different number generators, each with c = 0. Each invocation returns a random number X(n) := (MLCG1(n) - MLCG2(n)) mod (m1 - 1), where m1 denotes the modulus of MLCG1.

Member Typedef Documentation

template<class MLCG1 , class MLCG2 >
typedef MLCG1 boost::random::additive_combine_engine< MLCG1, MLCG2 >::first_base
template<class MLCG1 , class MLCG2 >
typedef MLCG1::result_type boost::random::additive_combine_engine< MLCG1, MLCG2 >::result_type
template<class MLCG1 , class MLCG2 >
typedef MLCG2 boost::random::additive_combine_engine< MLCG1, MLCG2 >::second_base

Constructor & Destructor Documentation

template<class MLCG1 , class MLCG2 >
boost::random::additive_combine_engine< MLCG1, MLCG2 >::additive_combine_engine ( )
inline

Constructs an additive_combine_engine using the default constructors of the two base generators.

template<class MLCG1 , class MLCG2 >
boost::random::additive_combine_engine< MLCG1, MLCG2 >::additive_combine_engine ( typename MLCG1::result_type  seed1,
typename MLCG2::result_type  seed2 
)
inline

Constructs an additive_combine_engine, using seed1 and seed2 as the constructor argument to the first and second base generators, respectively.

template<class MLCG1 , class MLCG2 >
template<class It >
boost::random::additive_combine_engine< MLCG1, MLCG2 >::additive_combine_engine ( It &  first,
It  last 
)
inline

Contructs an additive_combine_engine with values from the range defined by the input iterators first and last.

first will be modified to point to the element after the last one used.

Throws: std::invalid_argument if the input range is too small.

Exception Safety: Basic

Member Function Documentation

template<class MLCG1 , class MLCG2 >
static result_type min boost::random::additive_combine_engine< MLCG1, MLCG2 >::BOOST_PREVENT_MACRO_SUBSTITUTION ( )
inlinestatic

Returns the smallest value that the generator can produce.

template<class MLCG1 , class MLCG2 >
static result_type max boost::random::additive_combine_engine< MLCG1, MLCG2 >::BOOST_PREVENT_MACRO_SUBSTITUTION ( )
inlinestatic

Returns the largest value that the generator can produce.

template<class MLCG1 , class MLCG2 >
boost::random::additive_combine_engine< MLCG1, MLCG2 >::BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR ( additive_combine_engine< MLCG1, MLCG2 >  ,
result_type  ,
seed_arg   
)
inline

Constructs an additive_combine_engine, using seed as the constructor argument for both base generators.

template<class MLCG1 , class MLCG2 >
boost::random::additive_combine_engine< MLCG1, MLCG2 >::BOOST_RANDOM_DETAIL_ARITHMETIC_SEED ( additive_combine_engine< MLCG1, MLCG2 >  ,
result_type  ,
seed_arg   
)
inline

Seeds an additive_combine_engine, using seed as the seed for both base generators.

template<class MLCG1 , class MLCG2 >
boost::random::additive_combine_engine< MLCG1, MLCG2 >::BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR ( additive_combine_engine< MLCG1, MLCG2 >  ,
,
 
)
inline

Returns: true iff the two additive_combine_engines will produce the same sequence of values.

References boost::flyweights::x, and boost::polygon::y().

template<class MLCG1 , class MLCG2 >
boost::random::additive_combine_engine< MLCG1, MLCG2 >::BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR ( is  ,
additive_combine_engine< MLCG1, MLCG2 >  ,
 
)
inline

Reads the state of an additive_combine_engine from a std::istream.

template<class MLCG1 , class MLCG2 >
boost::random::additive_combine_engine< MLCG1, MLCG2 >::BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR ( os  ,
additive_combine_engine< MLCG1, MLCG2 >  ,
 
)
inline

Writes the state of an additive_combine_engine to a std::ostream.

The textual representation of an additive_combine_engine is the textual representation of the first base generator followed by the textual representation of the second base generator.

template<class MLCG1 , class MLCG2 >
boost::random::additive_combine_engine< MLCG1, MLCG2 >::BOOST_RANDOM_DETAIL_SEED_SEQ_CONSTRUCTOR ( additive_combine_engine< MLCG1, MLCG2 >  ,
SeedSeq  ,
seq   
)
inline

Constructs an additive_combine_engine, using seq as the constructor argument for both base generators.

The semantics of this function are liable to change. A seed_seq is designed to generate all the seeds in one shot, but this seeds the two base engines independantly and probably ends up giving the same sequence to both.

template<class MLCG1 , class MLCG2 >
boost::random::additive_combine_engine< MLCG1, MLCG2 >::BOOST_RANDOM_DETAIL_SEED_SEQ_SEED ( additive_combine_engine< MLCG1, MLCG2 >  ,
SeedSeq  ,
seq   
)
inline

Seeds an additive_combine_engine, using seq to seed both base generators.

See the warning on the corresponding constructor.

template<class MLCG1 , class MLCG2 >
boost::random::additive_combine_engine< MLCG1, MLCG2 >::BOOST_STATIC_CONSTANT ( bool  ,
has_fixed_range  = false 
)
template<class MLCG1 , class MLCG2 >
void boost::random::additive_combine_engine< MLCG1, MLCG2 >::discard ( boost::uintmax_t  z)
inline

Advances the state of the generator by z.

template<class MLCG1 , class MLCG2 >
template<class Iter >
void boost::random::additive_combine_engine< MLCG1, MLCG2 >::generate ( Iter  first,
Iter  last 
)
inline

Fills a range with random values.

template<class MLCG1 , class MLCG2 >
result_type boost::random::additive_combine_engine< MLCG1, MLCG2 >::operator() ( )
inline

Returns the next value of the generator.

template<class MLCG1 , class MLCG2 >
void boost::random::additive_combine_engine< MLCG1, MLCG2 >::seed ( )
inline

Seeds an additive_combine_engine using the default seeds of the two base generators.

template<class MLCG1 , class MLCG2 >
void boost::random::additive_combine_engine< MLCG1, MLCG2 >::seed ( typename MLCG1::result_type  seed1,
typename MLCG2::result_type  seed2 
)
inline

Seeds an additive_combine generator, using seed1 and seed2 as the seeds to the first and second base generators, respectively.

template<class MLCG1 , class MLCG2 >
template<class It >
void boost::random::additive_combine_engine< MLCG1, MLCG2 >::seed ( It &  first,
It  last 
)
inline

Seeds an additive_combine_engine with values from the range defined by the input iterators first and last.

first will be modified to point to the element after the last one used.

Throws: std::invalid_argument if the input range is too small.

Exception Safety: Basic


The documentation for this class was generated from the following file: