Module: Random::IntegerExtensions

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

Instance Method Summary collapse

Instance Method Details

#random_delta(last, exclude_end) ⇒ Object



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

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