3

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

Basically:

Guid.NewGuid() - Does it loop around or generate through some algorithm?

I want to use Guid because it offers 2^128 possibilities. According to the MSDN:

The chance that the value of the new Guid will be all zeros or equal to any other Guid is very low.

The problem is they don't say why it is low. Is it low because the chances are unlikely or is it low because it is unlikely to loop all the way around?

Community
  • 1
  • 1
michael
  • 14,844
  • 28
  • 89
  • 177
  • 1
    See [wikipedia](http://en.wikipedia.org/wiki/Globally_Unique_Identifier) and this post http://stackoverflow.com/questions/39771/is-a-guid-unique-100-of-the-time – Bala R Jun 24 '11 at 18:57

2 Answers2

2

Check out: http://en.wikipedia.org/wiki/Globally_unique_identifier#Algorithm

In the OSF-specified algorithm for generating new (V1) GUIDs, the user's network card MAC address is used as a base for the last group of GUID digits... Most of the other digits are based on the time while generating the GUID.

Ryan Gross
  • 6,423
  • 2
  • 32
  • 44
2

This is a pseudo unique value. The algorithm exists of course, but the probability of getting the same value twice is super small. They certainly can collide, but MS implementation is quite stable and uses several iterations of hashing (including BIOS timers etc), so that the value is something you can actually rely on.


Update.

There are many more GUID/UUID implementations performed for other purposes (e.g. Guid.comb algorithm for DB surrogate keys) - they actually can collide and I faced this myself in high loaded environments.

Arthur P
  • 1,050
  • 9
  • 16