
<Oliver.Kowalke@qimonda.com> wrote in news:B1EAFF2DAE7658488B631F25813CD91FD819DC@drsse602.eu.infineon.com:
Hello Andy,
My implementation of version 4 (random-number-based) guids may not be unique in space and time. It is based on boost::mt19937 to generate random numbers and it is seeded with std::time(0). Cryptographic-quality random numbers would reduce the probability of repeated values.
Using version 5 (name-based) guid can be used to ensure that guids are unique in space (guids generated on several computers at the same time) and time. Generate a guid for each computer as the namespace_guid and pass a counter as the name to the create function.
Because creating uuid v5 seams too expensive for me I could let one special computer (in my project == master) generate guids (unique in space). So I've make a decision wether uuid v4 or v1 should be used in order to be uinque in time?! Or do you have another suggestion?
I have not done any profiling/timing on any of the functions that create a guid. A note about multiple threads: all 3 versions are thread safe, but the random-number-based (version 4) and the time-based (version 1) function need a mutex to ensure that only one thread is creating a guid at a time. The name-based (version 5) does not need a mutex. As to decide between time-based (version 1) and random-number-based (version 4) for which would be unique in time, I would expect the time- based (version 1) to be more unique in time since only the node is generated randomly and only the first time a guid is generated (until the program is restarted). Whereas the random-number-based (version 4) is all just random data. Andy.
Regards,Oliver _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost