We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6803ebe commit 13c3102Copy full SHA for 13c3102
Ajax/common/BaseEnum.php
@@ -61,11 +61,12 @@ public static function isValidValue($value) {
61
public static function getRandomValue(bool $unique = false) {
62
$values = self::getConstantValues();
63
$count = \count($values);
64
- if ($unique && $count > count(self::$picked)) {
+ $calledClass = \get_called_class();
65
+ if ($unique && $count > count(self::$picked[$calledClass] ?? [])) {
66
do {
67
$newVal = $values[\rand(0, $count - 1)];
- } while (isset(self::$picked[$newVal]));
68
- self::$picked[$newVal] = true;
+ } while (isset(self::$picked[$calledClass][$newVal]));
69
+ self::$picked[$calledClass][$newVal] = true;
70
return $newVal;
71
}
72
return $values[\rand(0, $count - 1)];
0 commit comments