Browse Source
Merge pull request #1699 from DarkLordZach/deterministic-rng-3
csrng: Use random integer distribution instead of raw engine
pull/15/merge
bunnei
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
2 additions and
1 deletions
-
src/core/hle/service/spl/module.cpp
|
|
|
@ -28,8 +28,9 @@ void Module::Interface::GetRandomBytes(Kernel::HLERequestContext& ctx) { |
|
|
|
|
|
|
|
std::size_t size = ctx.GetWriteBufferSize(); |
|
|
|
|
|
|
|
std::uniform_int_distribution<u16> distribution(0, std::numeric_limits<u8>::max()); |
|
|
|
std::vector<u8> data(size); |
|
|
|
std::generate(data.begin(), data.end(), rng); |
|
|
|
std::generate(data.begin(), data.end(), [&] { return static_cast<u8>(distribution(rng)); }); |
|
|
|
|
|
|
|
ctx.WriteBuffer(data); |
|
|
|
|
|
|
|
|