List of usage examples for org.apache.mahout.math MurmurHash hash
public static int hash(ByteBuffer buf, int seed)
From source file:io.seldon.recommendation.VariationTestingClientStrategy.java
License:Apache License
public ClientStrategy sample(String userId) { Integer hash = MurmurHash.hash(userId.getBytes(), HASH_SEED); int sample = Math.abs(hash % 100); BigDecimal sampleDec = BigDecimal.valueOf(sample).divide(BigDecimal.valueOf(100)); for (Range range : strategyMap.keySet()) { if (range.containsNumber(sampleDec)) { return strategyMap.get(range); }/*from ww w . ja v a 2 s. c o m*/ } return null; }