4#ifndef TETL_RANDOM_UNIFORM_REAL_DISTRIBUTION_HPP
5#define TETL_RANDOM_UNIFORM_REAL_DISTRIBUTION_HPP
7#include <etl/_limits/numeric_limits.hpp>
8#include <etl/_random/generate_canonical.hpp>
13template <
typename RealType =
double>
15 using result_type = RealType;
22 explicit constexpr param_type(result_type min, result_type max = result_type(1))
noexcept
28 [[
nodiscard]]
constexpr auto a()
const noexcept -> result_type
33 [[
nodiscard]]
constexpr auto b()
const noexcept -> result_type
40 return (lhs._min == rhs._min)
and (lhs._max == rhs._max);
98 template <
typename URBG>
99 [[nodiscard]]
constexpr auto operator()(URBG& g)
noexcept(
noexcept(
g())) -> result_type
101 return (*
this)(g, _param);
104 template <
typename URBG>
105 [[nodiscard]]
constexpr auto operator()(URBG& g,
param_type const& parm)
noexcept(
noexcept(
g())) -> result_type
107 constexpr auto digits =
static_cast<size_t>(
numeric_limits<RealType>::digits);
108 constexpr auto bits = ~size_t{0};
109 constexpr auto minBits = digits < bits ? digits : bits;
110 static_assert(minBits <= 64);
113 auto const a = parm.a();
114 auto const b = parm.b();
115 auto const u =
etl::generate_canonical<RealType, minBits>(g);
116 return a + u * (b - a);
121 return x.param() == y.param();
Definition adjacent_find.hpp:9
Definition numeric_limits.hpp:18