Class: Range

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

Instance Method Summary collapse

Instance Method Details

#sample(opts = {}) ⇒ Object

Samples a value from within this range.

Parameters:

  • opts, keyword options for this method.

* => random, the RNG to use to sample from this range.



8
9
10
11
# File 'lib/patches/range.rb', line 8

def sample(opts = {})
	random = opts[:random] || Random.new
  random.rand(self)
end