Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Guid Uniqueness On different machine [duplicate]

Possible Duplicate:
Is a GUID unique 100% of the time?

After reading all posts on Guid, still I am unclear about one simple thing:

Guids generated by different machines also maintain their Uniqueness or not.

I have read about guid uniqueness on single machine,but I still don't know about uniqueness with different machines

like image 992
Rohit Garg Avatar asked Dec 28 '12 18:12

Rohit Garg


1 Answers

It is generally accepted that a new random GUID will ALWAYS be unique. Probabilistically this is not true, but the likelihood of generating a dupe is so small we don't need to care about it.

The odds of generating two identical guids is 1 in 5,316,911,983,139,663,491,615,228,241,121,400,000

So if you generate 1 million guids on 1 million computers, the odds of generating a duplicate are: 1 in 5,316,911,983,139,663,491,615,228

Take 1 billion guids on 1 billion computers, odds of generating a dupe are: 1 in 5,316,911,983,139,663,491 (that's 5.3 quintillion).

The numbers speak for themselves, you're not going to generate a dupe.

In case you're wondering where I'm getting these numbers, the value part of a GUID is 122 bit. 2^122 is 5.3169119831396634916152282411214 x 10^36

Some more crazy figures...
If you generate 1 million guids per second, it would take 168,486,464,147,580,370,470,736 years to probabilistically guarantee a duplicate.

@viggity mentioned some guids have 48 bits taken by a mac address, the numbers are still staggering hence the affordability to lose those bits. Taking the above example of 2 million guids per second (on the same computer), it would still take 598,584,166 years to guarantee a dupe. That's 600 million years. That's longer than life has existed on Earth. Or if you're a Young Earth Creationist, that's at least 60 thousand times the lifespan of Earth.

like image 101
Paul Fleming Avatar answered Sep 29 '22 08:09

Paul Fleming