Class: MimiCheck::Generator::Float
- Inherits:
-
Object
- Object
- MimiCheck::Generator::Float
- Includes:
- MimiCheck::Generator
- Defined in:
- lib/mimicheck/generator/float.rb
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(range = -1e10..1e10) ⇒ Float
constructor
A new instance of Float.
Methods included from MimiCheck::Generator
Constructor Details
#initialize(range = -1e10..1e10) ⇒ Float
Returns a new instance of Float.
6 7 8 9 |
# File 'lib/mimicheck/generator/float.rb', line 6 def initialize(range = -1e10..1e10) @min = range.min @max = range.max end |
Instance Method Details
#generate ⇒ Object
14 15 16 17 |
# File 'lib/mimicheck/generator/float.rb', line 14 def generate fail ArgumentError unless min && max Random.rand * (max - min) + min end |