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
All checks were successful
/ docker (push) Successful in 1m51s
This commit is contained in:
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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user