From b0092412bd35e444cc855b8e93f63671f82f99d9 Mon Sep 17 00:00:00 2001 From: Iliain Date: Mon, 21 Nov 2022 17:48:23 +1100 Subject: [PATCH] Random number can't go higher than array length --- src/UsernameRandomizer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/UsernameRandomizer.php b/src/UsernameRandomizer.php index d121372..5ff5350 100644 --- a/src/UsernameRandomizer.php +++ b/src/UsernameRandomizer.php @@ -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]; }