1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:24:57 +00:00

Userland: Replace arc4random() with get_random<u32>()

This commit is contained in:
Jean-Baptiste Boric 2021-05-14 17:27:38 +02:00 committed by Andreas Kling
parent 5a0468c21f
commit 090936e424
8 changed files with 19 additions and 12 deletions

View file

@ -5,6 +5,7 @@
*/
#include <AK/LexicalPath.h>
#include <AK/Random.h>
#include <LibCore/ArgsParser.h>
#include <fcntl.h>
#include <stdio.h>
@ -23,7 +24,7 @@ static char* generate_random_filename(const char* pattern)
for (auto i = pattern_length - 1; i >= 0; --i) {
if (pattern[i] != 'X')
break;
new_filename[i] = random_characters[(arc4random() % (sizeof(random_characters) - 1))];
new_filename[i] = random_characters[(get_random<u32>() % (sizeof(random_characters) - 1))];
}
return new_filename;