class DataAnon::Strategy::Field::RandomFloatDelta

Shifts the current value randomly within given delta + and -. Default is 10.0

!!!ruby
anonymize('points').using FieldStrategy::RandomFloatDelta.new(2.5)

Public Class Methods

new(delta = 10.0) click to toggle source
# File lib/strategy/field/number/random_float_delta.rb, line 12
def initialize delta = 10.0
  @delta = delta
end

Public Instance Methods

anonymize(field) click to toggle source
# File lib/strategy/field/number/random_float_delta.rb, line 16
def anonymize field
  return field.value + DataAnon::Utils::RandomFloat.generate(-@delta, +@delta)
end