NSUUID duplication chance form different device.
Asked Answered
W

1

2

I need to generate Unique ID for the device when the application installed, and store this value on the device, then need to communicate with server using this UUID. And it seems NSSUUD suit for the sitiation, but I am confused is there any chance of duplication of the UUID from multiple device. I already found the answer https://mcmap.net/q/49698/-how-unique-is-uuid where it describe that the version 1 type uses MAC address and 60 bit clock to generate UUID, so the duplication chance is negligible. Where as the Version4 uses some fixed number and some random number to generate the UUID, and the doc says that UUIDs created by NSUUID conform to RFC 4122 version 4 and are created with random bytes

Does that mean the chance of duplication higher?. Then how can I use version 1 type of UUID generator, I cant see any documentation for it.

Wanids answered 9/2, 2016 at 7:19 Comment(0)
N
4

You can have look at this RFC 4122. UUID conforming to RFC 4122 are practically unique in given space and time. You can also see Random UUID probability of duplicates.

Out of a total of 128 bits, two bits indicate an RFC 4122 ("Leach-Salz") UUID and four bits the version (0100 indicating "randomly generated"), so randomly generated UUIDs have 122 random bits. The chance of two such UUIDs having the same value can be calculated using probability theory (birthday problem). Probabilities of an accidental clash after calculating n UUIDs, with x = 122 is found to be very close to zero

For n=2^36 which is 68,719,476,736 probability of collision is found to be 0.0000000000000004. For lesser value of n, this value will be even less and probability increases as more UUID's are generated. In above estimation n represents number of UUID's generated.

Numerous answered 9/2, 2016 at 7:29 Comment(3)
Link only answers are discouraged on SO, links may not work in the future. Please, paste valuable information contained in the link in here, and provide link as the source.Discrown
Sure, i'll add relevant info shortlyNumerous
I think when ietf.org and wikipedia.org will be down we'll have bigger problems then not to be able to read this answer.Misconstruction

© 2022 - 2024 — McMap. All rights reserved.