Class: Range
- Inherits:
-
Object
- Object
- Range
- Defined in:
- lib/patches/range.rb
Instance Method Summary collapse
-
#sample(opts = {}) ⇒ Object
Samples a value from within this range.
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 |