@@ -236,7 +236,7 @@ internal class Evaluator(
236
236
' .' +
237
237
(getUnitID(user, rule.idType) ? : " " )
238
238
)
239
- .mod(10000f ) < rule.passPercentage.times(100f )
239
+ .mod(10000UL ) < ( rule.passPercentage.times(100.0 )).toULong( )
240
240
241
241
return ConfigEvaluation (
242
242
false ,
@@ -378,7 +378,7 @@ internal class Evaluator(
378
378
ConfigCondition .USER_BUCKET -> {
379
379
val salt = getValueAsString(condition.additionalValues[" salt" ])
380
380
val unitID = getUnitID(user, condition.idType) ? : " "
381
- value = computeUserHash(" $salt .$unitID " ).mod(1000f )
381
+ value = computeUserHash(" $salt .$unitID " ).mod(1000UL )
382
382
}
383
383
ConfigCondition .UNIT_ID -> {
384
384
value = getUnitID(user, condition.idType)
@@ -867,11 +867,11 @@ internal class Evaluator(
867
867
? : user.statsigEnvironment?.get(field.lowercase())
868
868
}
869
869
870
- private fun computeUserHash (input : String ): Float {
870
+ private fun computeUserHash (input : String ): ULong {
871
871
val md = MessageDigest .getInstance(" SHA-256" )
872
872
val inputBytes = input.toByteArray()
873
873
val bytes = md.digest(inputBytes)
874
- return ByteBuffer .wrap(bytes).float
874
+ return ByteBuffer .wrap(bytes).long.toULong()
875
875
}
876
876
877
877
private fun getUnitID (user : StatsigUser , idType : String? ): String? {
0 commit comments