mirror of
https://github.com/barkeser2002/flower.git
synced 2026-09-25 13:36:14 +03:00
23 lines
516 B
C++
23 lines
516 B
C++
#include "uuid.h"
|
|
#include <random>
|
|
|
|
// We use system generator.
|
|
#define UUID_SYSTEM_GENERATOR
|
|
#include <stduuid/uuid.h>
|
|
|
|
namespace engine
|
|
{
|
|
UUID buildUUID()
|
|
{
|
|
return uuids::to_string(uuids::uuid_system_generator{}());
|
|
}
|
|
|
|
// Simple random machine 64 bit uuid generator.
|
|
UUID64u buildRuntimeUUID64u()
|
|
{
|
|
static std::random_device randomDevice;
|
|
static std::mt19937_64 engine(randomDevice());
|
|
static std::uniform_int_distribution<uint64_t> uniformDistribution;
|
|
return uniformDistribution(engine);
|
|
}
|
|
} |