mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-21 13:15:02 +01:00
Improve random engine entropy and clean up random engine initialization
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include "utilities/utilities.h"
|
||||
#include "utilities/Globals.h"
|
||||
|
||||
class UID {
|
||||
public:
|
||||
@@ -14,10 +15,9 @@ public:
|
||||
|
||||
|
||||
static UID random() {
|
||||
static thread_local std::mt19937_64 gen{clock_seed()};
|
||||
UID u;
|
||||
uint64_t a = gen();
|
||||
uint64_t b = gen();
|
||||
uint64_t a = Global.random_engine();
|
||||
uint64_t b = Global.random_engine();
|
||||
for (int i = 0; i < 8; ++i) u.bytes[i] = uint8_t(a >> (i * 8) & 0xFF);
|
||||
for (int i = 0; i < 8; ++i) u.bytes[8 + i] = uint8_t(b >> (i * 8) & 0xFF);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user