Class: Range

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

Overview

class Encoding %w[ASCII_8BIT UTF_16BE UTF_16LE UTF_32BE UTF_32LE US_ASCII].each do |ec|

eval "#{ec} = '#{ec.sub '_', '-'}'"

end unless RUBY_PLATFORM =~ /linux/ or RUBY_PLATFORM =~ /darwin/ or RUBY_PLATFORM =~ /mingw/ end

Instance Method Summary collapse

Instance Method Details

#randObject



41
42
43
44
# File 'lib/shoes.rb', line 41

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