12 template<
typename Value>
15 if (max_value - min_value > std::numeric_limits<Value>::max()) {
16 throw std::invalid_argument(
17 "Difference between ``max_value`` and ``min_value`` "
18 "should not be greater than max possible value for type."
28 template<
typename Value>
30 static_assert(std::is_floating_point<Value>(),
31 "``Value`` should have floating point type.");
37 explicit Floats(Value min_value = 0.,
38 Value max_value = 1.) {
39 validate_floats<Value>(min_value,
41 min_value_ = min_value;
42 max_value_ = max_value;
49 static std::random_device random_device;
50 auto distribution = std::uniform_real_distribution<Value>(min_value_,
52 auto result = distribution(random_device);
Value operator()() const override
Definition: floats.h:48
void validate_floats(Value min_value, Value max_value)
Definition: floats.h:13
Floats(Value min_value=0., Value max_value=1.)
Definition: floats.h:37