![]() |
Home | Libraries | People | FAQ | More |
boost::random::splitmix64
// In header: <boost/random/splitmix64.hpp> class splitmix64 { public: // types typedef std::uint64_t result_type; typedef std::uint64_t seed_type; // private member functions std::uint64_t concatenate(std::uint32_t, std::uint32_t) noexcept; // public member functions void seed(result_type = 0) noexcept; template<typename Sseq, typename std::enable_if<!std::is_convertible< Sseq, std::uint64_t >::value, bool >::type = true> void seed(Sseq &); template<typename Sseq, typename std::enable_if<!std::is_convertible< Sseq, splitmix64 >::value, bool >::type = true> explicit splitmix64(Sseq &); template<typename T, typename std::enable_if< std::is_convertible< T, std::uint64_t >::value, bool >::type = true> void seed(T = 0) noexcept; explicit splitmix64(std::uint64_t = 0) noexcept; splitmix64(const splitmix64 &) = default; splitmix64 & operator=(const splitmix64 &) = default; result_type next() noexcept; result_type operator()() noexcept; void discard(std::uint64_t) noexcept; template<typename FIter> void generate(FIter, FIter) noexcept; // friend functions bool operator==(const splitmix64 &, const splitmix64 &) noexcept; bool operator!=(const splitmix64 &, const splitmix64 &) noexcept; template<typename CharT, typename Traits> std::basic_ostream< CharT, Traits > & operator<<(std::basic_ostream< CharT, Traits > &, const splitmix64 &); template<typename CharT, typename Traits> std::basic_istream< CharT, Traits > & operator>>(std::basic_istream< CharT, Traits > &, splitmix64 &); // public static functions static constexpr max() noexcept; static constexpr min() noexcept; // public data members static bool has_fixed_range; };
This is a fixed-increment version of Java 8's SplittableRandom generator See http://dx.doi.org/10.1145/2714064.2660195 and http://docs.oracle.com/javase/8/docs/api/java/util/SplittableRandom.html It is a very fast generator passing BigCrush, and it can be useful if for some reason you absolutely want 64 bits of state; otherwise, we rather suggest to use a xoroshiro128+ (for moderately parallel computations) or xorshift1024* (for massively parallel computations) generator.
splitmix64
public member functionsvoid seed(result_type value = 0) noexcept;
Seeds the generator with the default seed.
template<typename Sseq, typename std::enable_if<!std::is_convertible< Sseq, std::uint64_t >::value, bool >::type = true> void seed(Sseq & seq);
Seeds the generator with 32-bit values produced by seq.generate()
.
template<typename Sseq, typename std::enable_if<!std::is_convertible< Sseq, splitmix64 >::value, bool >::type = true> explicit splitmix64(Sseq & seq);
Seeds the generator with 64-bit values produced by seq.generate()
.
template<typename T, typename std::enable_if< std::is_convertible< T, std::uint64_t >::value, bool >::type = true> void seed(T value = 0) noexcept;
Seeds the generator with a user provided seed.
explicit splitmix64(std::uint64_t state = 0) noexcept;
Seeds the generator with a user provided seed.
splitmix64(const splitmix64 & other) = default;
splitmix64 & operator=(const splitmix64 & other) = default;
result_type next() noexcept;
Returns the next value of the generator.
result_type operator()() noexcept;
Returns the next value of the generator.
void discard(std::uint64_t z) noexcept;
Advances the state of the generator by z
.
template<typename FIter> void generate(FIter first, FIter last) noexcept;
Fills a range with random values
splitmix64
friend functionsbool operator==(const splitmix64 & lhs, const splitmix64 & rhs) noexcept;
Returns true if the two generators will produce identical sequences of values.
bool operator!=(const splitmix64 & lhs, const splitmix64 & rhs) noexcept;
Returns true if the two generators will produce different sequences of values.
template<typename CharT, typename Traits> std::basic_ostream< CharT, Traits > & operator<<(std::basic_ostream< CharT, Traits > & ost, const splitmix64 & e);
Writes a splitmix64
to a std::ostream
.
template<typename CharT, typename Traits> std::basic_istream< CharT, Traits > & operator>>(std::basic_istream< CharT, Traits > & ist, splitmix64 & e);
Writes a splitmix64
to a std::istream
.
splitmix64
public static functionsstatic constexpr max() noexcept;
Returns the largest value that the splitmix64
can produce.
static constexpr min() noexcept;
Returns the smallest value that the splitmix64
can produce.