Sha256: 1e703874a8d0671413c16bb72469dc33a0bf346a8fddff622a4cfa275db6b3b5

Contents?: true

Size: 226 Bytes

Versions: 6

Compression:

Stored size: 226 Bytes

Contents

module Laboratory
  module Algorithms
    class Random
      def self.pick!(variants)
        variants.min_by { |variant| - variant.percentage * rand }
      end

      def self.id
        'RANDOM'
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
laboratory-0.1.7 lib/laboratory/algorithms/random.rb
laboratory-0.1.6 lib/laboratory/algorithms/random.rb
laboratory-0.1.5 lib/laboratory/algorithms/random.rb
laboratory-0.1.4 lib/laboratory/algorithms/random.rb
laboratory-0.1.3 lib/laboratory/algorithms/random.rb
laboratory-0.1.2 lib/laboratory/algorithms/random.rb