We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0449039 commit 18197ccCopy full SHA for 18197cc
src/Generator/Passcode.php
@@ -14,12 +14,13 @@ class Passcode
14
public const DEFAULT_LENGTH = 6;
15
16
private const DIGITS = '1234567890';
17
+ private const TOTAL_DIGITS = 9;
18
19
public static function generate(int $length = self::DEFAULT_LENGTH): string
20
{
21
$code = [];
22
for ($amount = 0; $amount < $length; $amount++) {
- $code[] = self::DIGITS[mt_rand(0, 9)];
23
+ $code[] = self::DIGITS[mt_rand(0, self::TOTAL_DIGITS)];
24
}
25
26
return implode($code);
0 commit comments