Class: DataAnon::Strategy::Field::RandomFloat
- Inherits:
-
Object
- Object
- DataAnon::Strategy::Field::RandomFloat
- Defined in:
- lib/strategy/field/number/random_float.rb
Overview
Generates random float number between given two numbers. Default range is 0.0 to 100.0
anonymize('points').using FieldStrategy::RandomFloat.new(3.0,5.0)
Instance Method Summary collapse
- #anonymize(field) ⇒ Object
-
#initialize(from = 0.0, to = 100.0) ⇒ RandomFloat
constructor
A new instance of RandomFloat.
Constructor Details
#initialize(from = 0.0, to = 100.0) ⇒ RandomFloat
Returns a new instance of RandomFloat.
12 13 14 15 16 |
# File 'lib/strategy/field/number/random_float.rb', line 12 def initialize from = 0.0, to = 100.0 @from = from @to = to end |
Instance Method Details
#anonymize(field) ⇒ Object
18 19 20 |
# File 'lib/strategy/field/number/random_float.rb', line 18 def anonymize field DataAnon::Utils::RandomFloat.generate(@from,@to) end |