Skip to content

Commit 13c3102

Browse files
committed
Update BaseEnum.php
1 parent 6803ebe commit 13c3102

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Ajax/common/BaseEnum.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,12 @@ public static function isValidValue($value) {
6161
public static function getRandomValue(bool $unique = false) {
6262
$values = self::getConstantValues();
6363
$count = \count($values);
64-
if ($unique && $count > count(self::$picked)) {
64+
$calledClass = \get_called_class();
65+
if ($unique && $count > count(self::$picked[$calledClass] ?? [])) {
6566
do {
6667
$newVal = $values[\rand(0, $count - 1)];
67-
} while (isset(self::$picked[$newVal]));
68-
self::$picked[$newVal] = true;
68+
} while (isset(self::$picked[$calledClass][$newVal]));
69+
self::$picked[$calledClass][$newVal] = true;
6970
return $newVal;
7071
}
7172
return $values[\rand(0, $count - 1)];

0 commit comments

Comments
 (0)