Class: Range

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

Instance Method Summary collapse

Instance Method Details

#rand(precision = 0) ⇒ Object

Returns a random number between the min and max of the Range. An optional precision can be provided, which assumed to be 0 (eg. Fixnum.floor)



4
5
6
# File 'lib/madderlib/extensions.rb', line 4

def rand(precision=0)
	rand_from self.min, self.max, precision
end

#rand_inclusive(precision = 0) ⇒ Object

Returns a random number within the min and max of the Range, which can potentially include the max. An optional precision can be provided, which assumed to be 0 (eg. Fixnum.floor)



10
11
12
# File 'lib/madderlib/extensions.rb', line 10

def rand_inclusive(precision=0)
	rand_from self.min, self.max + 1, precision
end