Module: Unleash::Strategy::Util

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

Constant Summary collapse

NORMALIZER =
100

Class Method Summary collapse

Class Method Details

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

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



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

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