From 8cb2e7d881e1322a6132b3edff8a5ab65577a644 Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Thu, 15 Nov 2018 18:44:22 -0500 Subject: csrng: Use random integer distribution instead of raw engine Prevents returning the same value every single call. --- src/core/hle/service/spl/module.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/core/hle/service/spl/module.cpp b/src/core/hle/service/spl/module.cpp index 69c260408..b2de2a818 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 distribution(0, std::numeric_limits::max()); std::vector data(size); - std::generate(data.begin(), data.end(), rng); + std::generate(data.begin(), data.end(), [&] { return static_cast(distribution(rng)); }); ctx.WriteBuffer(data); -- cgit v1.2.3