1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:37:45 +00:00

Userland: Migrate from arc4random_uniform() to get_random_uniform()

This commit is contained in:
Jean-Baptiste Boric 2021-05-14 17:17:26 +02:00 committed by Andreas Kling
parent 069bf988ed
commit 5a0468c21f
5 changed files with 11 additions and 6 deletions

View file

@ -4,6 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/Random.h>
#include <AK/String.h>
#include <AK/Vector.h>
#include <errno.h>
@ -38,7 +39,7 @@ int main([[maybe_unused]] int argc, [[maybe_unused]] char** argv)
// Fisher-Yates shuffle
String tmp;
for (size_t i = lines.size() - 1; i >= 1; --i) {
size_t j = arc4random_uniform(i + 1);
size_t j = get_random_uniform(i + 1);
// Swap i and j
if (i == j)
continue;