Method: PropCheck::Generators.real_positive_float
- Defined in:
- lib/prop_check/generators.rb
permalink .real_positive_float ⇒ Object
Generates real floating-point numbers which are always positive Shrinks towards Float::MIN
Does not consider denormals. c.f. #real_float
>> Generators.real_positive_float().sample(10, size: 10, rng: Random.new(42))
=> [2.2, 0.2727272727272727, 4.0, 1.25, 3.7272727272727275, 8.833333333333334, 8.090909090909092, 1.1428571428571428, 2.2250738585072014e-308, 8.0]
192 193 194 |
# File 'lib/prop_check/generators.rb', line 192 def real_positive_float real_nonnegative_float.map { |val| val + Float::MIN } end |