aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/service/spl/module.cpp
diff options
context:
space:
mode:
authorZach Hilman <zachhilman@gmail.com>2018-11-15 18:44:22 -0500
committerZach Hilman <zachhilman@gmail.com>2018-11-15 18:44:26 -0500
commitdd46e96bcf9572d52e88e4d086b7dbe8174489f3 (patch)
treea90067e45aec7098d6609807c3c06c631551ce55 /src/core/hle/service/spl/module.cpp
parentb9ab52797bdfd7d8afa131071d1549d2d3dee7b0 (diff)
csrng: Use random integer distribution instead of raw engine
Prevents returning the same value every single call.
Diffstat (limited to 'src/core/hle/service/spl/module.cpp')
-rw-r--r--src/core/hle/service/spl/module.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/core/hle/service/spl/module.cpp b/src/core/hle/service/spl/module.cpp
index 69c2604080..b2de2a818c 100644
--- a/src/core/hle/service/spl/module.cpp
+++ b/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);