Module: Random::RangeExtensions
- Defined in:
- lib/garcon/core_ext/random.rb
Overview
Random extensions for Range class.
Instance Method Summary collapse
-
#at_rand ⇒ String
Return a random element from the range.
Instance Method Details
#at_rand ⇒ String
Return a random element from the range.
82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/garcon/core_ext/random.rb', line 82 def at_rand first, last = first(), last() if first.respond_to?(:random_delta) begin first.random_delta(last, exclude_end?) rescue to_a.at_rand end else to_a.at_rand end end |