diff --git a/src/Bucketing/Id.php b/src/Bucketing/Id.php index 8a075fb..a97f779 100644 --- a/src/Bucketing/Id.php +++ b/src/Bucketing/Id.php @@ -23,7 +23,7 @@ public function strToIntHash(string $idToHash): int $hex = hash(self::HASH_ALGO, $idToHash); $dec = hexdec($hex); - $x = $dec / self::TOTAL; - return (int) round($x * 100); + $x = (int) round($dec / self::TOTAL * 100); + return $x === 100 ? 99 : $x; } } diff --git a/src/Bucketing/Random.php b/src/Bucketing/Random.php index eef5b57..67c975c 100644 --- a/src/Bucketing/Random.php +++ b/src/Bucketing/Random.php @@ -18,6 +18,6 @@ public function __construct() public function strToIntHash(string $idToHash): int { - return $this->randomizer->getInt(0, 100); + return $this->randomizer->getInt(0, 99); } } diff --git a/src/Configurations/Config.php b/src/Configurations/Config.php index f8af5a4..5819aa7 100644 --- a/src/Configurations/Config.php +++ b/src/Configurations/Config.php @@ -39,9 +39,6 @@ public function pickVariantOutOfHat(string $id): string if ($hashOrRandomNumber < $variantRange) { return $variant; } - if ($hashOrRandomNumber === 100 && $variantRange === 100) { - return $variant; - } } return '';