mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
hle: kernel: system_control: Add function GenerateRandomU64.
This commit is contained in:
parent
c9235764c7
commit
e7c33d1ad6
2 changed files with 5 additions and 3 deletions
|
@ -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<u64> distribution(1, std::numeric_limits<u64>::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
|
||||
|
|
|
@ -9,5 +9,6 @@
|
|||
namespace Kernel::Memory::SystemControl {
|
||||
|
||||
u64 GenerateRandomRange(u64 min, u64 max);
|
||||
u64 GenerateRandomU64();
|
||||
|
||||
} // namespace Kernel::Memory::SystemControl
|
||||
|
|
Loading…
Reference in a new issue