4#ifndef TETL_RANDOM_UNIFORM_INT_DISTRIBUTION_HPP
5#define TETL_RANDOM_UNIFORM_INT_DISTRIBUTION_HPP
7#include <etl/_limits/numeric_limits.hpp>
12template <
typename IntType =
int>
14 using result_type = IntType;
21 explicit constexpr param_type(result_type min, result_type max = result_type(1))
noexcept
27 [[
nodiscard]]
constexpr auto a()
const noexcept -> result_type
32 [[
nodiscard]]
constexpr auto b()
const noexcept -> result_type
39 return (lhs._min == rhs._min)
and (lhs._max == rhs._max);
97 template <
typename URBG>
98 [[nodiscard]]
constexpr auto operator()(URBG& g)
noexcept(
noexcept(
g())) -> result_type
100 return (*
this)(g, _param);
103 template <
typename URBG>
104 [[nodiscard]]
constexpr auto operator()(URBG& g,
param_type const& parm)
noexcept(
noexcept(
g())) -> result_type
106 auto const random = g();
107 auto const range =
static_cast<
decltype(g())>(parm.b() - parm.a());
108 return static_cast<result_type>(parm.a() +
static_cast<result_type>(random % range));
113 return x.param() == y.param();
Definition adjacent_find.hpp:9
Definition numeric_limits.hpp:18