Class: PlanOut::UniformChoice

Inherits:
OpRandom show all
Defined in:
lib/plan_out/op_random.rb

Constant Summary

Constants inherited from OpRandom

OpRandom::LONG_SCALE

Instance Attribute Summary

Attributes inherited from Operator

#args

Instance Method Summary collapse

Methods inherited from OpRandom

#get_hash, #get_uniform, #get_unit

Methods inherited from OpSimple

#execute

Methods inherited from Operator

#execute, #initialize

Constructor Details

This class inherits a constructor from PlanOut::Operator

Instance Method Details

#simple_executeObject



77
78
79
80
81
82
# File 'lib/plan_out/op_random.rb', line 77

def simple_execute
  choices = @parameters[:choices]
  return [] if choices.length() == 0
  rand_index = get_hash() % choices.length()
  choices[rand_index]
end