![]() |
Home | Libraries | People | FAQ | More |
boost::random::lagged_fibonacci_01_engine
// In header: <boost/random/lagged_fibonacci.hpp> template<typename RealType, w, p, q> class lagged_fibonacci_01_engine { public: // types typedef RealType ; // construct/copy/destruct (); (uint32_t); template<typename SeedSeq> (SeedSeq &); template<typename It> (It &, It); // public member functions void (); void (boost::uint32_t); template<typename SeedSeq> void (SeedSeq &); template<typename It> void (It &, It); result_type (); template<typename Iter> void (Iter, Iter); void (boost::uintmax_t); // public static functions constexpr result_type (); constexpr result_type (); // friend functions template<typename CharT, typename Traits> CharT, Traits > & (CharT, Traits > &, const lagged_fibonacci_01_engine &); template<typename CharT, typename Traits> CharT, Traits > & (CharT, Traits > &, const lagged_fibonacci_01_engine &); bool (const lagged_fibonacci_01_engine &, const lagged_fibonacci_01_engine &); bool (const lagged_fibonacci_01_engine &, const lagged_fibonacci_01_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 boost::uint32_t default_seed; };
Instantiations of class template lagged_fibonacci_01
model a pseudo-random number generator . It uses a lagged Fibonacci algorithm with two lags p
and q
, evaluated in floating-point arithmetic: x(i) = x(i-p) + x(i-q) (mod 1) with p > q. See
"Uniform random number generators for supercomputers", Richard Brent, Proc. of Fifth Australian Supercomputer Conference, Melbourne, Dec. 1992, pp. 704-706.
![]() |
Note |
---|---|
The quality of the generator crucially depends on the choice of the parameters. User code should employ one of the sensibly parameterized generators such as lagged_fibonacci607 instead. |
The generator requires considerable amounts of memory for the storage of its state array. For example, lagged_fibonacci607 requires about 4856 bytes and lagged_fibonacci44497 requires about 350 KBytes.
lagged_fibonacci_01_engine
public
construct/copy/destruct();
Constructs a lagged_fibonacci_01
generator and calls seed()
.
(uint32_t value);
Constructs a lagged_fibonacci_01
generator and calls seed(value)
.
template<typename SeedSeq> (SeedSeq & seq);
Constructs a lagged_fibonacci_01
generator and calls seed(gen)
.
template<typename It> (It & first, It last);
lagged_fibonacci_01_engine
public member functionsvoid ();
Calls seed(default_seed).
void (boost::uint32_t value);
Constructs a minstd_rand0
generator with the constructor parameter value and calls seed with it. Distinct seeds in the range [1, 2147483647) will produce generators with different states. Other seeds will be equivalent to some seed within this range. See linear_congruential_engine
for details.
template<typename SeedSeq> void (SeedSeq & seq);
Seeds this
using values produced by lagged_fibonacci_01_engine
seq.generate
.
template<typename It> void (It & first, It last);
Seeds this
using values from the iterator range [first, last). If there are not enough elements in the range, throws lagged_fibonacci_01_engine
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_01_engine
public static functionsconstexpr result_type ();
Returns the smallest value that the generator can produce.
constexpr result_type ();
Returns the upper bound of the generators outputs.
lagged_fibonacci_01_engine
friend functionstemplate<typename CharT, typename Traits> CharT, Traits > & (CharT, Traits > & os, const lagged_fibonacci_01_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_01_engine & f);
Reads the textual representation of the generator from a std::istream
.
bool (const lagged_fibonacci_01_engine & x_, const lagged_fibonacci_01_engine & y_);
Returns true if the two generators will produce identical sequences of outputs.
bool (const lagged_fibonacci_01_engine & lhs, const lagged_fibonacci_01_engine & rhs);
Returns true if the two generators will produce different sequences of outputs.