From e7c33d1ad6b464a591279068f07a6b1de82109f6 Mon Sep 17 00:00:00 2001 From: bunnei Date: Mon, 8 Feb 2021 18:08:08 -0800 Subject: hle: kernel: system_control: Add function GenerateRandomU64. --- src/core/hle/kernel/memory/system_control.cpp | 7 ++++--- src/core/hle/kernel/memory/system_control.h | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/core/hle/kernel/memory/system_control.cpp b/src/core/hle/kernel/memory/system_control.cpp index 11d204bc2..e855696ad 100644 --- a/src/core/hle/kernel/memory/system_control.cpp +++ b/src/core/hle/kernel/memory/system_control.cpp @@ -25,16 +25,17 @@ u64 GenerateUniformRange(u64 min, u64 max, F f) { } } -u64 GenerateRandomU64ForInit() { +} // Anonymous namespace + +u64 GenerateRandomU64() { static std::random_device device; static std::mt19937 gen(device()); static std::uniform_int_distribution distribution(1, std::numeric_limits::max()); return distribution(gen); } -} // Anonymous namespace u64 GenerateRandomRange(u64 min, u64 max) { - return GenerateUniformRange(min, max, GenerateRandomU64ForInit); + return GenerateUniformRange(min, max, GenerateRandomU64); } } // namespace Kernel::Memory::SystemControl diff --git a/src/core/hle/kernel/memory/system_control.h b/src/core/hle/kernel/memory/system_control.h index 19cab8cbc..a01b6b014 100644 --- a/src/core/hle/kernel/memory/system_control.h +++ b/src/core/hle/kernel/memory/system_control.h @@ -9,5 +9,6 @@ namespace Kernel::Memory::SystemControl { u64 GenerateRandomRange(u64 min, u64 max); +u64 GenerateRandomU64(); } // namespace Kernel::Memory::SystemControl -- cgit v1.2.3