class Laboratory::Algorithms::Random
Public Class Methods
id()
click to toggle source
# File lib/laboratory/algorithms/random.rb, line 8 def self.id 'RANDOM' end
pick!(variants)
click to toggle source
# File lib/laboratory/algorithms/random.rb, line 4 def self.pick!(variants) variants.min_by { |variant| - variant.percentage * rand } end