1 #ifndef BLANK_RAND_GALOISLFSR_HPP_
2 #define BLANK_RAND_GALOISLFSR_HPP_
13 // seed should be non-zero
14 explicit GaloisLFSR(std::uint64_t seed) noexcept;
17 bool operator ()() noexcept;
20 T operator ()(T &out) noexcept {
21 constexpr int num_bits =
22 std::numeric_limits<T>::digits +
23 std::numeric_limits<T>::is_signed;
24 for (int i = 0; i < num_bits; ++i) {
27 return out = static_cast<T>(state);
32 // bits 64, 63, 61, and 60 set to 1 (counting from 1 lo to hi)
33 static constexpr std::uint64_t mask = 0xD800000000000000;