Module: Mayak::Random

Extended by:
T::Sig
Defined in:
lib/mayak/random.rb

Constant Summary collapse

DEFAULT_JITTER =
T.let(0.15, Float)

Class Method Summary collapse

Class Method Details

.jittered(number, jitter: DEFAULT_JITTER) ⇒ Object



11
12
13
14
# File 'lib/mayak/random.rb', line 11

def self.jittered(number, jitter: DEFAULT_JITTER)
  delta = Kernel.rand(0..(number * jitter))
  (number + delta.to_f).to_f
end