seed srand with current UUID timestamp
This commit is contained in:
parent
922deb81da
commit
00a32ea2f9
|
@ -28,7 +28,6 @@
|
|||
#include <cstdlib>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <ctime>
|
||||
|
||||
namespace UUID {
|
||||
|
||||
|
@ -380,7 +379,7 @@ uint16_t uuid::uuid1(uint64_t node, uint16_t clock_seq)
|
|||
void uuid::uuid4() {
|
||||
type_ = RFC4122;
|
||||
version_ = RAND;
|
||||
std::srand(std::time(nullptr));
|
||||
std::srand(now_());
|
||||
timestamp_ = std::rand();
|
||||
timestamp_ |= (uint64_t)std::rand() << 32;
|
||||
clock_seq_ = std::rand();
|
||||
|
|
Loading…
Reference in New Issue