Class: Mumukit::Randomizer::Randomization::Range

Inherits:
Base
  • Object
show all
Defined in:
lib/mumukit/randomizations/range.rb

Instance Attribute Summary

Attributes inherited from Base

#choices

Instance Method Summary collapse

Methods inherited from Base

#modulo, #size

Constructor Details

#initialize(lower_bound, upper_bound) ⇒ Range

Returns a new instance of Range.



2
3
4
# File 'lib/mumukit/randomizations/range.rb', line 2

def initialize(lower_bound, upper_bound)
  @choices = Range.new lower_bound, upper_bound
end

Instance Method Details

#get(value) ⇒ Object



6
7
8
# File 'lib/mumukit/randomizations/range.rb', line 6

def get(value)
  modulo(value, choices.first..choices.last)
end