module Random::Range

Public Instance Methods

at_rand() click to toggle source

Return a random element from the range.

(1..4).at_rand           #=> 2
(1..4).at_rand           #=> 4
# File lib/more/facets/random.rb, line 109
def at_rand
  array = to_a
  array.at(Random.number(array.size))
end