diff --git a/src/Core/UUID.cpp b/src/Core/UUID.cpp new file mode 100644 index 00000000000..ef1e10f5063 --- /dev/null +++ b/src/Core/UUID.cpp @@ -0,0 +1,19 @@ +#include +#include + + +namespace DB +{ + +namespace UUIDHelpers +{ + UUID generateV4() + { + UInt128 res{thread_local_rng(), thread_local_rng()}; + res.items[0] = (res.items[0] & 0xffffffffffff0fffull) | 0x0000000000004000ull; + res.items[1] = (res.items[1] & 0x3fffffffffffffffull) | 0x8000000000000000ull; + return UUID{res}; + } +} + +}