Class: Planout::UniformChoice
- Defined in:
- lib/planout/uniform_choice.rb
Constant Summary
Constants inherited from OpRandom
Instance Attribute Summary
Attributes inherited from Operator
Instance Method Summary collapse
Methods inherited from OpRandom
#get_hash, #get_uniform, #get_unit
Methods inherited from OpSimple
Methods inherited from Operator
Constructor Details
This class inherits a constructor from Planout::Operator
Instance Method Details
#simple_execute ⇒ Object
5 6 7 8 9 10 |
# File 'lib/planout/uniform_choice.rb', line 5 def simple_execute choices = @parameters[:choices] return [] if choices.length() == 0 rand_index = get_hash() % choices.length() choices[rand_index] end |