Module: Random::IntegerExtensions

Included in:
Integer
Defined in:
lib/standard/facets/random.rb

Overview

Random extensions fo Integer class.

Instance Method Summary collapse

Instance Method Details

#random_delta(last, exclude_end) ⇒ Object


104
105
106
107
108
109
# File 'lib/standard/facets/random.rb', line 104

def random_delta(last, exclude_end)
  first = self
  last -= 1 if exclude_end
  return nil if last < first
  return Random.number(last - first + 1) + first
end