Refactor Crypto::randomDigits()

This commit is contained in:
Art4 2024-11-09 23:18:13 +00:00
parent 29c0473b64
commit 940884e4bd
2 changed files with 3 additions and 11 deletions

View file

@ -306,13 +306,6 @@ class Crypto
*/
public static function randomDigits($digits)
{
$rn = '';
// generating cryptographically secure pseudo-random integers
for ($i = 0; $i < $digits; $i++) {
$rn .= random_int(0, 9);
}
return (int) $rn;
return random_int(0, 10 ** $digits - 1);
}
}