![]() |
Home | Libraries | People | FAQ | More |
boost::random::shuffle_order_engine
// In header: <boost/random/shuffle_order.hpp> template<typename UniformRandomNumberGenerator, k> class shuffle_order_engine { public: // types typedef ; typedef ; // construct/copy/destruct (); (); template<typename SeedSeq> (); (); (); template<typename It> (, ); // public member functions (); (); template<typename SeedSeq> (); template<typename It> (, ); () ; (); (); template<typename Iter> (, ); // public static functions (); (); // friend functions template<typename CharT, typename Traits> (, shuffle_order_engine &); template<typename CharT, typename Traits> (, shuffle_order_engine &); (shuffle_order_engine &, shuffle_order_engine &); (shuffle_order_engine &, shuffle_order_engine &); // public data members static has_fixed_range; static buffer_size; static table_size; };
Instatiations of class template shuffle_order_engine
model a pseudo-random number generator . It mixes the output of some (usually linear_congruential_engine) uniform random number generator 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.
shuffle_order_engine
public
construct/copy/destruct();
Constructs a
by invoking the default constructor of the base generator.shuffle_order_engine
Complexity: Exactly k+1 invocations of the base generator.
( s);
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.
template<typename SeedSeq> ( seq);
( rng);
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.
( rng);
template<typename It> ( first, last);
shuffle_order_engine
public member functions();
( seed);
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.
template<typename SeedSeq> ( seq);
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.
template<typename It> ( first, last);
() ;
();
( z);
Advances the generator by z steps.
template<typename Iter> ( first, last);
Fills a range with pseudo-random values.
shuffle_order_engine
friend functionstemplate<typename CharT, typename Traits> ( os, shuffle_order_engine & s);
Writes a
to a shuffle_order_engine
std::ostream
.
template<typename CharT, typename Traits> ( is, shuffle_order_engine & s);
Reads a
from a shuffle_order_engine
std::istream
.
(shuffle_order_engine & x, shuffle_order_engine & y);
Returns true if the two generators will produce identical sequences.
(shuffle_order_engine & lhs, shuffle_order_engine & rhs);
Returns true if the two generators will produce different sequences.