Skip to content

Commit

Permalink
Random number can't go higher than array length
Browse files Browse the repository at this point in the history
  • Loading branch information
Iliain authored Nov 21, 2022
1 parent 72fa6c2 commit b009241
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/UsernameRandomizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public static function generateID($seed = null, $numAdjectives = 2, $delimiter =
*/
public static function getRandomElement($words = [])
{
$index = rand(0, count($words));
$index = rand(0, count($words) - 1);
return $words[$index];
}

Expand Down

0 comments on commit b009241

Please sign in to comment.