Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::random::subtract_with_carry_engine< IntType, w, s, r > Class Template Reference

Instantiations of subtract_with_carry_engine model a . More...

#include <subtract_with_carry.hpp>

Public Types

typedef IntType result_type
 

Public Member Functions

 BOOST_STATIC_CONSTANT (std::size_t, word_size=w)
 
 BOOST_STATIC_CONSTANT (std::size_t, long_lag=r)
 
 BOOST_STATIC_CONSTANT (std::size_t, short_lag=s)
 
 BOOST_STATIC_CONSTANT (uint32_t, default_seed=19780503u)
 
 BOOST_STATIC_CONSTANT (bool, has_fixed_range=false)
 
 BOOST_STATIC_CONSTANT (result_type, modulus=(result_type(1)<< w))
 
 BOOST_STATIC_ASSERT (std::numeric_limits< result_type >::is_integer)
 
 subtract_with_carry_engine ()
 Constructs a new subtract_with_carry_engine and seeds it with the default seed. More...
 
 BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR (subtract_with_carry_engine, IntType, value)
 Constructs a new subtract_with_carry_engine and seeds it with value. More...
 
 BOOST_RANDOM_DETAIL_SEED_SEQ_CONSTRUCTOR (subtract_with_carry_engine, SeedSeq, seq)
 Constructs a new subtract_with_carry_engine and seeds it with values produced by seq.generate(). More...
 
template<class It >
 subtract_with_carry_engine (It &first, It last)
 Constructs a new subtract_with_carry_engine and seeds it with values from a range. More...
 
void seed ()
 Seeds the generator with the default seed. More...
 
 BOOST_RANDOM_DETAIL_ARITHMETIC_SEED (subtract_with_carry_engine, IntType, value)
 
 BOOST_RANDOM_DETAIL_SEED_SEQ_SEED (subtract_with_carry, SeedSeq, seq)
 Seeds the generator with values produced by seq.generate(). More...
 
template<class It >
void seed (It &first, It last)
 Seeds the generator with values from a range. More...
 
result_type operator() ()
 Returns the next value of the generator. More...
 
void discard (boost::uintmax_t z)
 Advances the state of the generator by z. More...
 
template<class It >
void generate (It first, It last)
 Fills a range with random values. More...
 
 BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR (os, subtract_with_carry_engine, f)
 Writes a subtract_with_carry_engine to a std::ostream. More...
 
 BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR (is, subtract_with_carry_engine, f)
 Reads a subtract_with_carry_engine from a std::istream. More...
 
 BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR (subtract_with_carry_engine, x, y)
 Returns true if the two generators will produce identical sequences 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 IntType, std::size_t w, std::size_t s, std::size_t r>
class boost::random::subtract_with_carry_engine< IntType, w, s, r >

Instantiations of subtract_with_carry_engine model a .

The algorithm is described in

"A New Class of Random Number Generators", George Marsaglia and Arif Zaman, Annals of Applied Probability, Volume 1, Number 3 (1991), 462-480.

Member Typedef Documentation

template<class IntType , std::size_t w, std::size_t s, std::size_t r>
typedef IntType boost::random::subtract_with_carry_engine< IntType, w, s, r >::result_type

Constructor & Destructor Documentation

template<class IntType , std::size_t w, std::size_t s, std::size_t r>
boost::random::subtract_with_carry_engine< IntType, w, s, r >::subtract_with_carry_engine ( )
inline

Constructs a new subtract_with_carry_engine and seeds it with the default seed.

References boost::random::subtract_with_carry_engine< IntType, w, s, r >::seed().

template<class IntType , std::size_t w, std::size_t s, std::size_t r>
template<class It >
boost::random::subtract_with_carry_engine< IntType, w, s, r >::subtract_with_carry_engine ( It &  first,
It  last 
)
inline

Constructs a new subtract_with_carry_engine and seeds it with values from a range.

first is updated to point one past the last value consumed. If there are not enough elements in the range to fill the entire state of the generator, throws std::invalid_argument.

References boost::random::subtract_with_carry_engine< IntType, w, s, r >::seed().

Member Function Documentation

template<class IntType , std::size_t w, std::size_t s, std::size_t r>
static result_type min boost::random::subtract_with_carry_engine< IntType, w, s, r >::BOOST_PREVENT_MACRO_SUBSTITUTION ( )
inlinestatic

Returns the smallest value that the generator can produce.

template<class IntType , std::size_t w, std::size_t s, std::size_t r>
static result_type max boost::random::subtract_with_carry_engine< IntType, w, s, r >::BOOST_PREVENT_MACRO_SUBSTITUTION ( )
inlinestatic

Returns the largest value that the generator can produce.

template<class IntType , std::size_t w, std::size_t s, std::size_t r>
boost::random::subtract_with_carry_engine< IntType, w, s, r >::BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR ( subtract_with_carry_engine< IntType, w, s, r >  ,
IntType  ,
value   
)
inline
template<class IntType , std::size_t w, std::size_t s, std::size_t r>
boost::random::subtract_with_carry_engine< IntType, w, s, r >::BOOST_RANDOM_DETAIL_ARITHMETIC_SEED ( subtract_with_carry_engine< IntType, w, s, r >  ,
IntType  ,
value   
)
inline
template<class IntType , std::size_t w, std::size_t s, std::size_t r>
boost::random::subtract_with_carry_engine< IntType, w, s, r >::BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR ( subtract_with_carry_engine< IntType, w, s, r >  ,
,
 
)
inline

Returns true if the two generators will produce identical sequences of values.

References boost::polygon::y().

template<class IntType , std::size_t w, std::size_t s, std::size_t r>
boost::random::subtract_with_carry_engine< IntType, w, s, r >::BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR ( is  ,
subtract_with_carry_engine< IntType, w, s, r >  ,
 
)
inline

Reads a subtract_with_carry_engine from a std::istream.

template<class IntType , std::size_t w, std::size_t s, std::size_t r>
boost::random::subtract_with_carry_engine< IntType, w, s, r >::BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR ( os  ,
subtract_with_carry_engine< IntType, w, s, r >  ,
 
)
inline

Writes a subtract_with_carry_engine to a std::ostream.

template<class IntType , std::size_t w, std::size_t s, std::size_t r>
boost::random::subtract_with_carry_engine< IntType, w, s, r >::BOOST_RANDOM_DETAIL_SEED_SEQ_CONSTRUCTOR ( subtract_with_carry_engine< IntType, w, s, r >  ,
SeedSeq  ,
seq   
)
inline
template<class IntType , std::size_t w, std::size_t s, std::size_t r>
boost::random::subtract_with_carry_engine< IntType, w, s, r >::BOOST_RANDOM_DETAIL_SEED_SEQ_SEED ( subtract_with_carry  ,
SeedSeq  ,
seq   
)
inline

Seeds the generator with values produced by seq.generate().

template<class IntType , std::size_t w, std::size_t s, std::size_t r>
boost::random::subtract_with_carry_engine< IntType, w, s, r >::BOOST_STATIC_ASSERT ( std::numeric_limits< result_type >::is_integer  )
template<class IntType , std::size_t w, std::size_t s, std::size_t r>
boost::random::subtract_with_carry_engine< IntType, w, s, r >::BOOST_STATIC_CONSTANT ( std::size_t  ,
word_size  = w 
)
template<class IntType , std::size_t w, std::size_t s, std::size_t r>
boost::random::subtract_with_carry_engine< IntType, w, s, r >::BOOST_STATIC_CONSTANT ( std::size_t  ,
long_lag  = r 
)
template<class IntType , std::size_t w, std::size_t s, std::size_t r>
boost::random::subtract_with_carry_engine< IntType, w, s, r >::BOOST_STATIC_CONSTANT ( std::size_t  ,
short_lag  = s 
)
template<class IntType , std::size_t w, std::size_t s, std::size_t r>
boost::random::subtract_with_carry_engine< IntType, w, s, r >::BOOST_STATIC_CONSTANT ( uint32_t  ,
default_seed  = 19780503u 
)
template<class IntType , std::size_t w, std::size_t s, std::size_t r>
boost::random::subtract_with_carry_engine< IntType, w, s, r >::BOOST_STATIC_CONSTANT ( bool  ,
has_fixed_range  = false 
)
template<class IntType , std::size_t w, std::size_t s, std::size_t r>
boost::random::subtract_with_carry_engine< IntType, w, s, r >::BOOST_STATIC_CONSTANT ( result_type  ,
modulus  = (result_type(1)<< w) 
)
template<class IntType , std::size_t w, std::size_t s, std::size_t r>
void boost::random::subtract_with_carry_engine< IntType, w, s, r >::discard ( boost::uintmax_t  z)
inline

Advances the state of the generator by z.

References boost::random::detail::subtract_with_carry_discard::apply().

template<class IntType , std::size_t w, std::size_t s, std::size_t r>
template<class It >
void boost::random::subtract_with_carry_engine< IntType, w, s, r >::generate ( It  first,
It  last 
)
inline

Fills a range with random values.

template<class IntType , std::size_t w, std::size_t s, std::size_t r>
result_type boost::random::subtract_with_carry_engine< IntType, w, s, r >::operator() ( )
inline

Returns the next value of the generator.

template<class IntType , std::size_t w, std::size_t s, std::size_t r>
template<class It >
void boost::random::subtract_with_carry_engine< IntType, w, s, r >::seed ( It &  first,
It  last 
)
inline

Seeds the generator with values from a range.

Updates first to point one past the last consumed value. If the range does not contain enough elements to fill the entire state of the generator, throws std::invalid_argument.

References boost::xpressive::first, and boost::last.


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