Module: Unleash::Strategy::Util

Defined in:
lib/unleash/strategy/util.rb

Constant Summary collapse

NORMALIZER =
100
VARIANT_NORMALIZER_SEED =
86_028_157

Class Method Summary collapse

Class Method Details

.get_normalized_number(identifier, group_id, seed, base = NORMALIZER) ⇒ Object

convert the two strings () into a number between 1 and base (100 by default)



12
13
14
# File 'lib/unleash/strategy/util.rb', line 12

def get_normalized_number(identifier, group_id, seed, base = NORMALIZER)
  MurmurHash3::V32.str_hash("#{group_id}:#{identifier}", seed) % base + 1
end