Class: Range
Overview
Extensions to the Range class
Instance Method Summary collapse
-
#pick_one ⇒ Object
(also: #rand)
This method returns a random number between the lower and upper bound.
Instance Method Details
#pick_one ⇒ Object Also known as: rand
This method returns a random number between the lower and upper bound
179 180 181 182 183 |
# File 'lib/rbot/core/utils/extends.rb', line 179 def pick_one len = self.last - self.first len += 1 unless self.exclude_end? self.first + Kernel::rand(len) end |