|
| ThreefryEngine (result_type s=0) |
|
template<typename SeedSeq > |
| ThreefryEngine (SeedSeq &seq, typename cxx11::enable_if< internal::is_seed_seq< SeedSeq, result_type, key_type, ThreefryEngine< ResultType, K, Rounds > >::value >::type *=nullptr) |
|
| ThreefryEngine (const key_type &k) |
|
ctr_type | ctr () const |
|
void | ctr (const ctr_type &c) |
|
void | discard (result_type nskip) |
|
key_type | key () const |
|
void | key (const key_type &k) |
|
result_type | operator() () |
|
buffer_type | operator() (const ctr_type &c) const |
| Generate a buffer of random bits given a counter using the current key. More...
|
|
void | operator() (const ctr_type &c, buffer_type &buf) const |
| Generate random bits in a pre-allocated buffer given a counter using the current key. More...
|
|
void | seed (result_type s) |
|
template<typename SeedSeq > |
void | seed (SeedSeq &seq, typename cxx11::enable_if< internal::is_seed_seq< SeedSeq, result_type, key_type, ThreefryEngine< ResultType, K, Rounds > >::value >::type *=nullptr) |
|
void | seed (const key_type &k) |
|
|
bool | operator!= (const ThreefryEngine< ResultType, K, Rounds > &eng1, const ThreefryEngine< ResultType, K, Rounds > &eng2) |
|
template<typename CharT , typename Traits > |
std::basic_ostream< CharT, Traits > & | operator<< (std::basic_ostream< CharT, Traits > &os, const ThreefryEngine< ResultType, K, Rounds > &eng) |
|
bool | operator== (const ThreefryEngine< ResultType, K, Rounds > &eng1, const ThreefryEngine< ResultType, K, Rounds > &eng2) |
|
template<typename CharT , typename Traits > |
std::basic_istream< CharT, Traits > & | operator>> (std::basic_istream< CharT, Traits > &is, ThreefryEngine< ResultType, K, Rounds > &eng) |
|
template<typename ResultType, std::size_t K, std::size_t Rounds = 20>
class vsmc::ThreefryEngine< ResultType, K, Rounds >
Threefry RNG engine reimplemented.
This is a reimplementation of the algorithm Threefry as described in Parallel Random Numbers: As Easy as 1, 2, 3 and implemented in Random123.
Depending on the compilers, processors and RNG configurations, it might be slightly faster or slower than the original implementation. At most two-folds performace difference (both faster and slower) were observed.
This implementation is slightly more flexible in the sense that it does not limit the number of rounds. However, larger number of rounds can have undesired effects. To say the least, currently all loops are unrolled, which can slow down significantly when the number of rounds is large.
Compared to r123:Engine<r123::Threefry4x32>
etc., when using the default constructor or the one with a single seed, the output shall be exactly the same for the first \(2^n\) iterations, where \(n\) is the number of bits (32 or 64). Further iterations may produce different results, as vSMC increment the counter slightly differently, but it still cover the same range and has the same period as the original.
Definition at line 265 of file threefry.hpp.