diff --git a/docs/model.md b/docs/model.md index b0946e6..611f5cf 100644 --- a/docs/model.md +++ b/docs/model.md @@ -1,6 +1,6 @@ # Evaluation Model -* Version: `2.0.0` +* Version: `2.1.1` * Created: 2024-02-02 * Last Modified: - * Author: Brian Giori (@bgiori) @@ -133,10 +133,6 @@ An allocation defines a `max`, `range`, and the `distribution` of variants withi ```kotlin data class EvaluationAllocation( - // The max for the allocation range. This number is used to modulo the hash - // to compare with the range. - val max: Int = 100, - // The distribution range [0, max). That is the possibles values are [0, max-1]. // E.g. with max 100, [0, 49] is 50% allocation val range: List, diff --git a/evaluation-core/src/commonMain/kotlin/EvaluationAllocation.kt b/evaluation-core/src/commonMain/kotlin/EvaluationAllocation.kt index ce08446..bb36e59 100644 --- a/evaluation-core/src/commonMain/kotlin/EvaluationAllocation.kt +++ b/evaluation-core/src/commonMain/kotlin/EvaluationAllocation.kt @@ -4,14 +4,10 @@ import kotlinx.serialization.Serializable @Serializable data class EvaluationAllocation( - // The max for the allocation range. This number is used to modulo the hash - // to compare with the range. - val max: Int = 100, - // The distribution range [0, max). That is the possibles values are [0, max-1]. // E.g. with max 100, [0, 49] is 50% allocation val range: List, // The distribution of variants if allocated. - val distributions: List + val distributions: List, ) diff --git a/evaluation-core/src/commonMain/kotlin/EvaluationEngine.kt b/evaluation-core/src/commonMain/kotlin/EvaluationEngine.kt index f194273..c57193d 100644 --- a/evaluation-core/src/commonMain/kotlin/EvaluationEngine.kt +++ b/evaluation-core/src/commonMain/kotlin/EvaluationEngine.kt @@ -141,7 +141,7 @@ class EvaluationEngineImpl(private val log: Logger? = null) : EvaluationEngine { val hash = getHash(keyToHash) // Iterate over allocations. If the value falls within the range, check the distribution. for (allocation in segment.bucket.allocations) { - val allocationValue = hash % allocation.max + val allocationValue = hash % 100 val allocationStart = allocation.range[0] val allocationEnd = allocation.range[1] if (allocationValue in allocationStart until allocationEnd) {