diff --git a/include/stratosphere/random.hpp b/include/stratosphere/random.hpp index 9e67dd2c..877f97c4 100644 --- a/include/stratosphere/random.hpp +++ b/include/stratosphere/random.hpp @@ -21,6 +21,7 @@ class StratosphereRandomUtils { public: static u32 GetRandomU32(u32 max); static u64 GetRandomU64(u64 max); + static void GetRandomBytes(void* out, size_t size); template static T GetRandom(T max); diff --git a/source/random.cpp b/source/random.cpp index 03439392..8bd83304 100644 --- a/source/random.cpp +++ b/source/random.cpp @@ -82,3 +82,7 @@ u64 StratosphereRandomUtils::GetRandomU64(u64 max) { return GetRandom(max); } +void StratosphereRandomUtils::GetRandomBytes(void* out, size_t size) { + std::generate(reinterpret_cast(out), reinterpret_cast(out) + size, std::bind(GetRandom, 0xFF)); +} +