59 const std::vector<Choice>&
choices() const noexcept {
return choices_; }
62 std::uint64_t next_raw() noexcept;
63 double next_raw_double() noexcept;
64 std::uint64_t next_raw_below(std::uint64_t bound) noexcept;
67 Choice next_replayed(std::uint64_t bound) noexcept;
71 std::array<std::uint64_t, 4> state_{};
72 std::vector<Choice> choices_;
74 bool replaying_ =
false;
75 std::vector<Choice> replay_;
76 std::size_t replay_position_ = 0;
The one source of randomness a Simulation may use.
Definition rng.hpp:28
std::uint64_t Choice
One recorded random draw. See the class comment.
Definition rng.hpp:31
const std::vector< Choice > & choices() const noexcept
Every choice made so far, in order: what was actually used, after clamping.
Definition rng.hpp:59
VirtualRng(std::uint64_t seed) noexcept
A generator that draws fresh numbers from seed.
std::uint64_t next_below(std::uint64_t bound)
Uniform in [0, bound), without modulo bias.
std::uint64_t next_between(std::uint64_t low, std::uint64_t high)
Uniform in [low, high], both included. low must not exceed high.
std::uint64_t next_u64()
Uniform over all 64-bit values.
static VirtualRng replaying(std::vector< Choice > choices)
A generator that answers draws from choices instead of computing them.
bool chance(double probability)
True with the given probability.
double next_double()
Uniform in [0, 1). Built from next_u64(), so it shrinks toward 0.0.