mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-24 00:01:49 +01:00
Make UUID::GenerateUuidV4
use util::GetRandomBytes
This commit is contained in:
parent
10d43c88c9
commit
ea3c7301b1
@ -56,16 +56,9 @@ namespace skyline {
|
|||||||
constexpr u8 reserved{0x1}; // RFC4122 variant
|
constexpr u8 reserved{0x1}; // RFC4122 variant
|
||||||
constexpr u8 version{0x4}; // v4 UUIDs are generated entirely from random numbers
|
constexpr u8 version{0x4}; // v4 UUIDs are generated entirely from random numbers
|
||||||
|
|
||||||
std::random_device rd;
|
|
||||||
std::mt19937_64 gen(rd());
|
|
||||||
|
|
||||||
std::uniform_int_distribution<u64> dist;
|
|
||||||
|
|
||||||
// Create an initial random UUID
|
// Create an initial random UUID
|
||||||
UuidLayout uuid{
|
UuidLayout uuid;
|
||||||
.low = dist(gen),
|
util::FillRandomBytes(span(&uuid, 1).cast<u64>());
|
||||||
.high = dist(gen),
|
|
||||||
};
|
|
||||||
|
|
||||||
// Set format bits
|
// Set format bits
|
||||||
uuid.reserved = reserved;
|
uuid.reserved = reserved;
|
||||||
|
Loading…
Reference in New Issue
Block a user