diff --git a/lib/Generator.php b/lib/Generator.php index ca9ea63f..b578b848 100644 --- a/lib/Generator.php +++ b/lib/Generator.php @@ -85,6 +85,9 @@ public function generate(): string { $password .= $chars = $this->random->generate($length, $chars); + // Shuffle string so the order is random + $password = str_shuffle($password); + try { $this->validator->validate($password); @@ -108,9 +111,6 @@ public function generate(): string { throw new HintException('Could not generate a valid password'); } - // Shuffle string so the order is random - $password = str_shuffle($password); - return $password; } }