#include "rand_guid.h" #include #include #include #include namespace NYql { TAtomic TRandGuid::Counter = 0; TRandGuid::TRandGuid() { ResetSeed(); } void TRandGuid::ResetSeed() { new (&Rnd_) TMersenne(GetCycleCount() + MicroSeconds() + GetPID()); } TString TRandGuid::GenGuid() { TGUID ret = {}; WriteUnaligned(ret.dw, GetRnd().GenRand()); ret.dw[2] = (ui32)GetRnd().GenRand(); ret.dw[3] = AtomicIncrement(Counter); return GetGuidAsString(ret); } ui64 TRandGuid::GenNumber() { return GetRnd().GenRand(); } }