33 template <
typename Generator> T
operator()(Generator &gen) {
34 static_assert(std::is_integral_v<T>,
"T needs to be an integral type");
35 if (
auto fixed = std::get_if<T>(&dist)) {
39 if (
auto normal = std::get_if<std::normal_distribution<double>>(&dist)) {
40 double number = normal->operator()(gen);
41 return static_cast<uint64_t
>(std::clamp(number, 0.0, std::numeric_limits<double>::max()));
44 if (
auto uniform = std::get_if<std::uniform_int_distribution<T>>(&dist)) {
45 return uniform->operator()(gen);
48 if (
auto discrete = std::get_if<std::discrete_distribution<T>>(&dist)) {
49 return discrete->operator()(gen);
51 throw std::runtime_error(
"invalid distribution");
54 std::variant<T, std::normal_distribution<double>, std::uniform_int_distribution<T>,