the simple idea we have about GUID is that it's unique, but how GUIDs are generated ? could we generate two identical GUIDs based on the same generation methods used.
-
1There are many articles on this subject available at your preferred search engine, starting with our own forum: http://stackoverflow.com/questions/1705008/simple-proof-that-guid-is-not-unique – Bob Kaufman Nov 24 '11 at 14:12
2 Answers
Yes, we can generate same GUID twice, but with probability close to zero enough to make this event practically impossible.

- 11,878
- 2
- 35
- 51
-
2Looking at it another way, the chance of a duplicate GUID is less than the chance that there has been a hardware failure in your computer somewhere, causing an incorrect GUID to be produced. – rossum Nov 24 '11 at 15:12
GUIDS aren't guaranteed to be unique, however they are said to be "statistically unique" since the probability of creating the same guid twice is statistically insignificant. For all intensive purposes, you'll be safe to assume that any GUID you create (properly) is unique.
As to how GUIDs are generated, they use different algorithms depending on the type of GUID. For instance, SQL Server's "uniqueidentifier" datatype uses a V4 GUID which is based on a pseudorandom data generator whereas other versions of GUIDs can be based on hash functions or a combination of MAC adress and time.
Is it possible to generate a duplicate GUID? Well of course, but the chances of it happening are just statistically insignificant.
Trust the GUID. It exists to make your life easier :)

- 600
- 6
- 15
-
+1 Nice read. I was having the same fear but probably won't happen any soon. – Rushino Jan 10 '13 at 17:25