ZeroC

Archived

This forum has been archived. Please start a new discussion on GitHub.

generateUUID()

jmsanchez
jmsanchez
Hi,

We need to generate a global unique identificator for different machines, to identify them in a server. In order to achieve that, we were thinking about using the generateUUID() function on each computer, to self-generate the identificator. Is this a good approach? What are the chances that two different machines get same number? Which algorithm is using this function?

Thank you in advance

Comments

  • benoit
    benoit Rennes, France
    Hi,

    On Windows we rely on UuidCreate and on Unix platforms we generate a random sequence of bytes along with the process ID. See the source code for the details.

    Cheers,
    Benoit.
  • jmsanchez
    jmsanchez
    So, the UUID has nothing to do with the RFC4122?

    https://www.ietf.org/rfc/rfc4122.txt

    Thank you
  • benoit
    benoit Rennes, France
    Hi,

    On Unix platforms, we generate the version 4 UUIDs described in the RFC with the exception that we replace the last 2 bytes with the process ID (this was necessary to work-around a Linux kernel bug).

    Cheers,
    Benoit.