Sha256: aa6f1ac76cb762b791e028954450c2053899fe8e2cdfec5dd912e2c5fef0a004
Contents?: true
Size: 642 Bytes
Versions: 7
Compression:
Stored size: 642 Bytes
Contents
# Selects alternative with minimum count of participants # If all counts are even (i.e. all are minimum), samples from all possible alternatives module Split module Algorithms module BlockRandomization class << self def choose_alternative(experiment) minimum_participant_alternatives(experiment.alternatives).sample end private def minimum_participant_alternatives(alternatives) alternatives_by_count = alternatives.group_by(&:participant_count) min_group = alternatives_by_count.min_by { |k, v| k } min_group.last end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems