Home Help Center

generateUUID()

jmsanchezjmsanchez Member Jose Manuel Sanchez Matamoros PerezOrganization: ZennioProject: home automation system remote controller
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

  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    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.
  • jmsanchezjmsanchez Member Jose Manuel Sanchez Matamoros PerezOrganization: ZennioProject: home automation system remote controller
    So, the UUID has nothing to do with the RFC4122?

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

    Thank you
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    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.
Sign In or Register to comment.