mirror of
https://github.com/Atmosphere-NX/Atmosphere-libs.git
synced 2025-06-29 22:42:40 +02:00
Added GetRandomBytes (#10)
This commit is contained in:
parent
8ec43f0d69
commit
8f2328975a
@ -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<typename T>
|
||||
static T GetRandom(T max);
|
||||
|
@ -82,3 +82,7 @@ u64 StratosphereRandomUtils::GetRandomU64(u64 max) {
|
||||
return GetRandom<u64>(max);
|
||||
}
|
||||
|
||||
void StratosphereRandomUtils::GetRandomBytes(void* out, size_t size) {
|
||||
std::generate(reinterpret_cast<u8*>(out), reinterpret_cast<u8*>(out) + size, std::bind(GetRandom<u8>, 0xFF));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user