Class: Laboratory::Algorithms::Random
- Inherits:
-
Object
- Object
- Laboratory::Algorithms::Random
- Defined in:
- lib/laboratory/algorithms/random.rb
Class Method Summary collapse
Class Method Details
.id ⇒ Object
8 9 10 |
# File 'lib/laboratory/algorithms/random.rb', line 8 def self.id 'RANDOM' end |
.pick!(variants) ⇒ Object
4 5 6 |
# File 'lib/laboratory/algorithms/random.rb', line 4 def self.pick!(variants) variants.min_by { |variant| - variant.percentage * rand } end |