3#ifndef pRC_CORE_RANDOM_DISTRIBUTIONS_UNIFORM_H
4#define pRC_CORE_RANDOM_DISTRIBUTIONS_UNIFORM_H
42 "Parameter a of uniform real distribution must be less "
43 "than parameter b. Range of values is [a,b).");
51 "Parameter a of uniform integer distribution must be "
52 "less than or equal to parameter b. Range of values is "
60 constexpr auto &
a()
const
65 constexpr auto &
b()
const
70 constexpr auto min()
const
75 constexpr auto max()
const
92 constexpr auto range = [](
auto const a,
auto const b)
98 return UInt(
b) + UInt(-
a);
101 return UInt(
b) - UInt(
a);
104 auto const r =
range(
a(),
b());
109 constexpr auto R =
range(URNG::min(), URNG::max());
114 basic = UInt(rng()) - URNG::min();
118 auto const scaling = R / (r + UInt(1));
119 auto const past = (r + UInt(1)) * scaling;
122 basic = UInt(rng()) - URNG::min();
124 while(basic >= past);
134 tmp = ((R + UInt(1)) *
136 param_type(0, r / (R + UInt(1)))));
137 basic = tmp + (UInt(rng()) - URNG::min());
139 while(basic > r || basic < tmp);
144 "Found the impossible basic R < r of same type "
145 "with R being the maximum limit.");
162 return lhs.
a() == rhs.
a() && lhs.
b() == rhs.
b();
169 return !(lhs == rhs);
Definition distribution.hpp:12
static void error(Xs &&...args)
Definition log.hpp:14
Definition cholesky.hpp:10
std::common_type_t< Ts... > Common
Definition basics.hpp:53
static constexpr auto generateCanonical(RNG &rng)
Definition canonical.hpp:16
static constexpr auto operator!=(JacobiRotation< TA > const &a, JacobiRotation< TB > const &b)
Definition jacobi_rotation.hpp:291
static constexpr auto range(F &&f, Xs &&...args)
Definition range.hpp:18
static constexpr auto operator==(JacobiRotation< TA > const &a, JacobiRotation< TB > const &b)
Definition jacobi_rotation.hpp:284
static constexpr auto identity()
Definition identity.hpp:13
static constexpr auto zero()
Definition zero.hpp:12