Class: Range

Inherits:
Object
  • Object
show all
Defined in:
lacci/lib/shoes/ruby_extensions.rb

Instance Method Summary collapse

Instance Method Details

#randObject



3
4
5
6
# File 'lacci/lib/shoes/ruby_extensions.rb', line 3

def rand
  conv = (Integer === self.end && Integer === self.begin ? :to_i : :to_f)
  ((Kernel.rand * (self.end - self.begin)) + self.begin).send(conv)
end