19 #include "SquaresKeys.hpp" 28 typedef uint64_t init_type;
29 typedef uint64_t state_type;
30 typedef uint64_t seed_type;
31 typedef uint64_t advance_type;
32 typedef uint32_t result_type;
38 , seed_(seed_type{splitmix<seed_type>(s)}) {}
41 : state_(other.getState())
42 , seed_(other.getSeed()) {}
45 if (
this == &other)
return *
this;
47 state_ = other.getState();
48 seed_ = other.getSeed();
53 inline result_type operator()(
void) {
56 y = x = seed_ * state_;
60 x = (x >> 32) | (x << 32);
63 x = (x >> 32) | (x << 32);
66 x = (x >> 32) | (x << 32);
70 return (x * x + z) >> 32;
73 inline void reset(
void) { state_ = 0; }
75 inline void discard(advance_type n) { state_ += n; }
77 inline seed_type getSeed()
const {
return seed_; }
79 inline void setSeed(seed_type seed) { seed_ = seed; }
81 inline state_type getState()
const {
return state_; }
83 inline void setState(state_type state) { state_ = state; }
85 inline static uint64_t generateSeed(
size_t i) {
return keys[i]; }
87 static constexpr result_type min() {
return 0; }
89 static constexpr result_type max() {
90 return std::numeric_limits<result_type>::max();
93 friend inline std::ostream& operator<<(std::ostream& os,
const Squares4_64& be) {
94 return os <<
"state: " << be.getState() <<
" seed: " << be.getSeed();