Re: How to create an UUID (Version 1)
- Posted by jmduro Sep 29, 2018
- 3845 views
ghaberek said...
According to the documentation, uuid_generate is going to create a random UUID by default:
The uuid_generate function creates a new universally unique identifier (UUID). The uuid will be generated
based on high-quality randomness from /dev/urandom, if available. If it is not available, then
uuid_generate will use an alternative algorithm which uses the current time, the local ethernet MAC
address (if available), and random data generated using a pseudo-random generator.
based on high-quality randomness from /dev/urandom, if available. If it is not available, then
uuid_generate will use an alternative algorithm which uses the current time, the local ethernet MAC
address (if available), and random data generated using a pseudo-random generator.
In that case, I could follow the same method: read bytes from /dev/urandom if I can, otherwise generate it based on the current time, MAC address, and rand().
I can't remember where I read that yesterday but even libuuid is not guaranteed to provide unique identifiers and uuid_generate is based on libuuid.
Jean-Marc