I am working on a project where I need to generate approximately 1 billion GUIDs.
I know GUIDs are not guaranteed to be unique but are unique almost all of the time.
If I generated a billion GUIDs, what is the probability that there will be a match?
Likelihood of Collision Assuming a perfect source of entropy on each device generating random GUIDs, there is a 50% chance of collision after 2.7e18 random GUIDs have been generated. That's more than 2.7 million million million.
Technically they are 128-bit unique reference numbers used in computing which are highly unlikely to repeat when generated despite there being no central GUID authority to ensure uniqueness.
GUID generation algorithm 4 fills the GUID with 122 random bits. The odds of two GUIDs colliding are therefore one in 2¹²², which is a phenomenally small number.
The GUID generation algorithm relies on the fact that it has all 16 bytes to use to establish uniqueness, and if you throw away half of it, you lose the uniqueness. There are multiple GUID generation algorithms, but I'll pick one of them for concreteness, specifically the version described in this Internet draft.
http://blogs.msdn.com/b/oldnewthing/archive/2008/06/27/8659071.aspx
The .NET GUID consists of
So the UUID probability quoted by Oscar does not work here. But if you create all your 1 billion GUIDs from one computer, there is no chance to get a duplicate (except you are playing with the clock ;-)
If you are creating the GUIds from the same machine and using the same algorithm then you will not get a collision.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With