37 static uint64_t
min();
38 static uint64_t
max();
56 Rng& operator=(
Rng&&) noexcept = default;
57 ~
Rng() noexcept = default;
81 explicit
Rng(uint64_t seed) noexcept;
82 Rng(uint64_t x, uint64_t y) noexcept;
83 Rng(std::vector<uint64_t> const& data);
99 inline uint64_t operator()() noexcept {
102 mX = UINT64_C(15241094284759029579) * mY;
103 mY = rotl(mY - x, 27);
126 inline uint32_t
bounded(uint32_t range) noexcept {
127 uint64_t r32 =
static_cast<uint32_t
>(
operator()());
128 auto multiresult = r32 * range;
129 return static_cast<uint32_t
>(multiresult >> 32U);
143 auto i = (UINT64_C(0x3ff) << 52U) | (
operator()() >> 12U);
147 std::memcpy(&d, &i,
sizeof(
double));
159 template <
typename Container>
161 auto size =
static_cast<uint32_t
>(container.size());
162 for (
auto i = size; i > 1U; --i) {
165 swap(container[i - 1], container[p]);
176 std::vector<uint64_t>
state()
const;
179 static uint64_t rotl(uint64_t x,
unsigned k) noexcept;
Rng(Rng &&) noexcept=default
Rng & operator=(Rng const &)=delete
static uint64_t min()
Definition: rng.cpp:54
uint32_t bounded(uint32_t range) noexcept
Definition: rng.h:126
std::vector< uint64_t > state() const
Definition: rng.cpp:46
uint64_t result_type
This RNG provides 64bit randomness.
Definition: rng.h:35
double uniform01() noexcept
Definition: rng.h:142
void shuffle(Container &container) noexcept
Definition: rng.h:160
Rng copy() const noexcept
Definition: rng.cpp:35
static uint64_t max()
Definition: rng.cpp:56
uint64_t operator()() noexcept
Produces a 64bit random value. This should be very fast, thus it is marked as inline....
Definition: rng.h:99
#define ZEROERR_SUPPRESS_COMMON_WARNINGS_POP
Definition: config.h:265
#define ZEROERR_SUPPRESS_COMMON_WARNINGS_PUSH
Definition: config.h:218
Definition: benchmark.cpp:17