Is a GUID unique 100% of the time?

前端 未结 22 2562
孤独总比滥情好
孤独总比滥情好 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:35

    Guids are statistically unique. The odds of two different clients generating the same Guid are infinitesimally small (assuming no bugs in the Guid generating code). You may as well worry about your processor glitching due to a cosmic ray and deciding that 2+2=5 today.

    Multiple threads allocating new guids will get unique values, but you should get that the function you are calling is thread safe. Which environment is this in?

提交回复
热议问题