Is a GUID unique 100% of the time?

前端 未结 22 2563
孤独总比滥情好
孤独总比滥情好 2020-11-22 01:31

Is a GUID unique 100% of the time?

Will it stay unique over multiple threads?

22条回答
  •  温柔的废话
    2020-11-22 02:31

    I have experienced the GUIDs not being unique during multi-threaded/multi-process unit-testing (too?). I guess that has to do with, all other tings being equal, the identical seeding (or lack of seeding) of pseudo random generators. I was using it for generating unique file names. I found the OS is much better at doing that :)

    Trolling alert

    You ask if GUIDs are 100% unique. That depends on the number of GUIDs it must be unique among. As the number of GUIDs approach infinity, the probability for duplicate GUIDs approach 100%.

提交回复
热议问题