Class: Range
- Inherits:
-
Object
- Object
- Range
- Defined in:
- /home/apoc/projects/ruby/rbot/lib/rbot/core/utils/extends.rb
Overview
Extensions to the Range class
Instance Method Summary (collapse)
-
- (Object) pick_one
(also: #rand)
This method returns a random number between the lower and upper bound.
Instance Method Details
- (Object) pick_one Also known as: rand
This method returns a random number between the lower and upper bound
190 191 192 193 194 |
# File '/home/apoc/projects/ruby/rbot/lib/rbot/core/utils/extends.rb', line 190 def pick_one len = self.last - self.first len += 1 unless self.exclude_end? self.first + Kernel::rand(len) end |