![]() |
Home | Libraries | People | FAQ | More |
boost::random::lagged_fibonacci_engine
// In header: <boost/random/lagged_fibonacci.hpp> template<typename UIntType, w, p, q> class lagged_fibonacci_engine { public: // types typedef UIntType ; // construct/copy/destruct (); (UIntType); template<typename SeedSeq> (SeedSeq &); template<typename It> (It &, It); // public static functions constexpr result_type (); constexpr result_type (); // public member functions void (); void (UIntType); template<typename SeedSeq> void (SeedSeq &); template<typename It> void (It &, It); result_type (); template<typename Iter> void (Iter, Iter); void (boost::uintmax_t); // friend functions template<typename CharT, typename Traits> CharT, Traits > & (CharT, Traits > &, const lagged_fibonacci_engine &); template<typename CharT, typename Traits> CharT, Traits > & (CharT, Traits > &, const lagged_fibonacci_engine &); bool (const lagged_fibonacci_engine &, const lagged_fibonacci_engine &); bool (const lagged_fibonacci_engine &, const lagged_fibonacci_engine &); // public data members static const bool has_fixed_range; static const int word_size; static const unsigned int long_lag; static const unsigned int short_lag; static const UIntType default_seed; };
Instantiations of class template lagged_fibonacci_engine model a pseudo-random number generator . It uses a lagged Fibonacci algorithm with two lags p
and q:
x(i) = x(i-p) + x(i-q) (mod 2w) with p > q.
lagged_fibonacci_engine
public
construct/copy/destruct();
Creates a new
and calls lagged_fibonacci_engine
seed()
.
(UIntType value);
Creates a new
and calls lagged_fibonacci_engine
seed(value)
.
template<typename SeedSeq> (SeedSeq & seq);
Creates a new
and calls lagged_fibonacci_engine
seed(seq)
.
template<typename It> (It & first, It last);
Creates a new
and calls lagged_fibonacci_engine
seed(first, last)
.
lagged_fibonacci_engine
public static functionsconstexpr result_type ();
Returns the smallest value that the generator can produce.
constexpr result_type ();
Returns the largest value that the generator can produce.
lagged_fibonacci_engine
public member functionsvoid ();
Calls seed(default_seed)
.
void (UIntType value);
Sets the state of the generator to values produced by a minstd_rand0
generator.
template<typename SeedSeq> void (SeedSeq & seq);
Sets the state of the generator using values produced by seq.
template<typename It> void (It & first, It last);
Sets the state of the generator to values from the iterator range [first, last). If there are not enough elements in the range [first, last) throws std::invalid_argument
.
result_type ();
Returns the next value of the generator.
template<typename Iter> void (Iter first, Iter last);
Fills a range with random values
void (boost::uintmax_t z);
Advances the state of the generator by z
.
lagged_fibonacci_engine
friend functionstemplate<typename CharT, typename Traits> CharT, Traits > & (CharT, Traits > & os, const lagged_fibonacci_engine & f);
Writes the textual representation of the generator to a std::ostream
.
template<typename CharT, typename Traits> CharT, Traits > & (CharT, Traits > & is, const lagged_fibonacci_engine & f);
Reads the textual representation of the generator from a std::istream
.
bool (const lagged_fibonacci_engine & x_, const lagged_fibonacci_engine & y_);
Returns true if the two generators will produce identical sequences of outputs.
bool (const lagged_fibonacci_engine & lhs, const lagged_fibonacci_engine & rhs);
Returns true if the two generators will produce different sequences of outputs.