Class: Range

Inherits:
Object show all
Defined in:
/home/apoc/projects/ruby/rbot/lib/rbot/core/utils/extends.rb

Overview

Extensions to the Range class

Instance Method Summary (collapse)

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