Class: Mumukit::Randomizer::Randomization::Range
- Defined in:
- lib/mumukit/randomizations/range.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #get(value) ⇒ Object
-
#initialize(lower_bound, upper_bound) ⇒ Range
constructor
A new instance of Range.
Methods inherited from Base
Constructor Details
#initialize(lower_bound, upper_bound) ⇒ Range
2 3 4 5 6 |
# File 'lib/mumukit/randomizations/range.rb', line 2 def initialize(lower_bound, upper_bound) raise 'lower bound must be Numeric' unless lower_bound.is_a?(Numeric) raise 'upper bound must be Numeric' unless upper_bound.is_a?(Numeric) @choices = Range.new lower_bound, upper_bound end |
Instance Method Details
#get(value) ⇒ Object
8 9 10 |
# File 'lib/mumukit/randomizations/range.rb', line 8 def get(value) modulo(value, choices) end |