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

Instatiations of class template shuffle_order_engine model a . More...

#include <shuffle_order.hpp>

Public Types

typedef
UniformRandomNumberGenerator 
base_type
 
typedef base_type::result_type result_type
 

Public Member Functions

 BOOST_STATIC_CONSTANT (bool, has_fixed_range=false)
 
 BOOST_STATIC_CONSTANT (std::size_t, buffer_size=k)
 
 BOOST_STATIC_CONSTANT (std::size_t, table_size=k)
 
 BOOST_STATIC_ASSERT (std::numeric_limits< result_type >::is_integer)
 
 BOOST_STATIC_ASSERT (k > 0)
 
 shuffle_order_engine ()
 Constructs a shuffle_order_engine by invoking the default constructor of the base generator. More...
 
 BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR (shuffle_order_engine, result_type, s)
 Constructs a shuffle_output_engine by invoking the one-argument constructor of the base generator with the parameter seed. More...
 
 BOOST_RANDOM_DETAIL_SEED_SEQ_CONSTRUCTOR (shuffle_order_engine, SeedSeq, seq)
 
 shuffle_order_engine (const base_type &rng)
 Constructs a shuffle_output_engine by using a copy of the provided generator. More...
 
 shuffle_order_engine (base_type &&rng)
 
template<class It >
 shuffle_order_engine (It &first, It last)
 
void seed ()
 
 BOOST_RANDOM_DETAIL_ARITHMETIC_SEED (shuffle_order_engine, result_type, seed_arg)
 Invokes the one-argument seed method of the base generator with the parameter seed and re-initializes the internal buffer array. More...
 
 BOOST_RANDOM_DETAIL_SEED_SEQ_SEED (shuffle_order_engine, SeedSeq, seq)
 Invokes the one-argument seed method of the base generator with the parameter seq and re-initializes the internal buffer array. More...
 
template<class It >
void seed (It &first, It last)
 
const base_typebase () const
 
result_type operator() ()
 
void discard (boost::uintmax_t z)
 Advances the generator by z steps. More...
 
template<class Iter >
void generate (Iter first, Iter last)
 Fills a range with pseudo-random values. More...
 
 BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR (os, shuffle_order_engine, s)
 Writes a shuffle_order_engine to a std::ostream. More...
 
 BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR (is, shuffle_order_engine, s)
 Reads a shuffle_order_engine from a std::istream. More...
 
 BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR (shuffle_order_engine, x, y)
 Returns true if the two generators will produce identical sequences. 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 UniformRandomNumberGenerator, std::size_t k>
class boost::random::shuffle_order_engine< UniformRandomNumberGenerator, k >

Instatiations of class template shuffle_order_engine model a .

It mixes the output of some (usually ) to get better statistical properties. The algorithm is described in

"Improving a poor random number generator", Carter Bays and S.D. Durham, ACM Transactions on Mathematical Software, Vol 2, No. 1, March 1976, pp. 59-64. http://doi.acm.org/10.1145/355666.355670

The output of the base generator is buffered in an array of length k. Every output X(n) has a second role: It gives an index into the array where X(n+1) will be retrieved. Used array elements are replaced with fresh output from the base generator.

Template parameters are the base generator and the array length k, which should be around 100.

Member Typedef Documentation

template<class UniformRandomNumberGenerator , std::size_t k>
typedef UniformRandomNumberGenerator boost::random::shuffle_order_engine< UniformRandomNumberGenerator, k >::base_type
template<class UniformRandomNumberGenerator , std::size_t k>
typedef base_type::result_type boost::random::shuffle_order_engine< UniformRandomNumberGenerator, k >::result_type

Constructor & Destructor Documentation

template<class UniformRandomNumberGenerator , std::size_t k>
boost::random::shuffle_order_engine< UniformRandomNumberGenerator, k >::shuffle_order_engine ( )
inline

Constructs a shuffle_order_engine by invoking the default constructor of the base generator.

Complexity: Exactly k+1 invocations of the base generator.

References boost::unit_test::framework::init().

template<class UniformRandomNumberGenerator , std::size_t k>
boost::random::shuffle_order_engine< UniformRandomNumberGenerator, k >::shuffle_order_engine ( const base_type rng)
inlineexplicit

Constructs a shuffle_output_engine by using a copy of the provided generator.

Precondition: The template argument UniformRandomNumberGenerator shall denote a CopyConstructible type.

Complexity: Exactly k+1 invocations of the base generator.

References boost::unit_test::framework::init().

template<class UniformRandomNumberGenerator , std::size_t k>
boost::random::shuffle_order_engine< UniformRandomNumberGenerator, k >::shuffle_order_engine ( base_type &&  rng)
inlineexplicit
template<class UniformRandomNumberGenerator , std::size_t k>
template<class It >
boost::random::shuffle_order_engine< UniformRandomNumberGenerator, k >::shuffle_order_engine ( It &  first,
It  last 
)
inline

Member Function Documentation

template<class UniformRandomNumberGenerator , std::size_t k>
const base_type& boost::random::shuffle_order_engine< UniformRandomNumberGenerator, k >::base ( ) const
inline
template<class UniformRandomNumberGenerator , std::size_t k>
static result_type min boost::random::shuffle_order_engine< UniformRandomNumberGenerator, k >::BOOST_PREVENT_MACRO_SUBSTITUTION ( )
inlinestatic

Returns the smallest value that the generator can produce.

References boost::accumulators::extract::min.

template<class UniformRandomNumberGenerator , std::size_t k>
static result_type max boost::random::shuffle_order_engine< UniformRandomNumberGenerator, k >::BOOST_PREVENT_MACRO_SUBSTITUTION ( )
inlinestatic

Returns the largest value that the generator can produce.

References boost::accumulators::extract::max.

template<class UniformRandomNumberGenerator , std::size_t k>
boost::random::shuffle_order_engine< UniformRandomNumberGenerator, k >::BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR ( shuffle_order_engine< UniformRandomNumberGenerator, k >  ,
result_type  ,
 
)
inline

Constructs a shuffle_output_engine by invoking the one-argument constructor of the base generator with the parameter seed.

Complexity: Exactly k+1 invocations of the base generator.

References boost::unit_test::framework::init(), and boost::asio::s.

template<class UniformRandomNumberGenerator , std::size_t k>
boost::random::shuffle_order_engine< UniformRandomNumberGenerator, k >::BOOST_RANDOM_DETAIL_ARITHMETIC_SEED ( shuffle_order_engine< UniformRandomNumberGenerator, k >  ,
result_type  ,
seed_arg   
)
inline

Invokes the one-argument seed method of the base generator with the parameter seed and re-initializes the internal buffer array.

Complexity: Exactly k+1 invocations of the base generator.

References boost::unit_test::framework::init().

template<class UniformRandomNumberGenerator , std::size_t k>
boost::random::shuffle_order_engine< UniformRandomNumberGenerator, k >::BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR ( shuffle_order_engine< UniformRandomNumberGenerator, k >  ,
,
 
)
inline

Returns true if the two generators will produce identical sequences.

References boost::algorithm::detail::equal(), and boost::flyweights::x.

template<class UniformRandomNumberGenerator , std::size_t k>
boost::random::shuffle_order_engine< UniformRandomNumberGenerator, k >::BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR ( is  ,
shuffle_order_engine< UniformRandomNumberGenerator, k >  ,
 
)
inline

Reads a shuffle_order_engine from a std::istream.

References boost::multiprecision::backends::i, and boost::asio::s.

template<class UniformRandomNumberGenerator , std::size_t k>
boost::random::shuffle_order_engine< UniformRandomNumberGenerator, k >::BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR ( os  ,
shuffle_order_engine< UniformRandomNumberGenerator, k >  ,
 
)
inline

Writes a shuffle_order_engine to a std::ostream.

References boost::multiprecision::backends::i, and boost::asio::s.

template<class UniformRandomNumberGenerator , std::size_t k>
boost::random::shuffle_order_engine< UniformRandomNumberGenerator, k >::BOOST_RANDOM_DETAIL_SEED_SEQ_CONSTRUCTOR ( shuffle_order_engine< UniformRandomNumberGenerator, k >  ,
SeedSeq  ,
seq   
)
inline
template<class UniformRandomNumberGenerator , std::size_t k>
boost::random::shuffle_order_engine< UniformRandomNumberGenerator, k >::BOOST_RANDOM_DETAIL_SEED_SEQ_SEED ( shuffle_order_engine< UniformRandomNumberGenerator, k >  ,
SeedSeq  ,
seq   
)
inline

Invokes the one-argument seed method of the base generator with the parameter seq and re-initializes the internal buffer array.

Complexity: Exactly k+1 invocations of the base generator.

References boost::unit_test::framework::init().

template<class UniformRandomNumberGenerator , std::size_t k>
boost::random::shuffle_order_engine< UniformRandomNumberGenerator, k >::BOOST_STATIC_ASSERT ( std::numeric_limits< result_type >::is_integer  )
template<class UniformRandomNumberGenerator , std::size_t k>
boost::random::shuffle_order_engine< UniformRandomNumberGenerator, k >::BOOST_STATIC_ASSERT ( ,
 
)
template<class UniformRandomNumberGenerator , std::size_t k>
boost::random::shuffle_order_engine< UniformRandomNumberGenerator, k >::BOOST_STATIC_CONSTANT ( bool  ,
has_fixed_range  = false 
)
template<class UniformRandomNumberGenerator , std::size_t k>
boost::random::shuffle_order_engine< UniformRandomNumberGenerator, k >::BOOST_STATIC_CONSTANT ( std::size_t  ,
buffer_size  = k 
)
template<class UniformRandomNumberGenerator , std::size_t k>
boost::random::shuffle_order_engine< UniformRandomNumberGenerator, k >::BOOST_STATIC_CONSTANT ( std::size_t  ,
table_size  = k 
)
template<class UniformRandomNumberGenerator , std::size_t k>
void boost::random::shuffle_order_engine< UniformRandomNumberGenerator, k >::discard ( boost::uintmax_t  z)
inline

Advances the generator by z steps.

template<class UniformRandomNumberGenerator , std::size_t k>
template<class Iter >
void boost::random::shuffle_order_engine< UniformRandomNumberGenerator, k >::generate ( Iter  first,
Iter  last 
)
inline

Fills a range with pseudo-random values.

template<class UniformRandomNumberGenerator , std::size_t k>
result_type boost::random::shuffle_order_engine< UniformRandomNumberGenerator, k >::operator() ( )
inline
template<class UniformRandomNumberGenerator , std::size_t k>
void boost::random::shuffle_order_engine< UniformRandomNumberGenerator, k >::seed ( )
inline
template<class UniformRandomNumberGenerator , std::size_t k>
template<class It >
void boost::random::shuffle_order_engine< UniformRandomNumberGenerator, k >::seed ( It &  first,
It  last 
)
inline

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