make the random string generator more random - fixing being able to predict the file id more easily
All checks were successful
/ docker (push) Successful in 1m51s

This commit is contained in:
Lee 2023-07-05 00:44:51 +01:00
parent a56fe5d619
commit 0c354b30d5

@ -30,9 +30,14 @@ function generateRandomString($length = 10): string
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)];
// Shuffle the characters array
$shuffledCharacters = str_shuffle($characters);
$randomIndex = random_int(0, $charactersLength - 1);
$randomString .= $shuffledCharacters[$randomIndex];
}
return $randomString;
}