GUID是否在100%的时间内是唯一的? [英] Is a GUID unique 100% of the time?

查看:119
本文介绍了GUID是否在100%的时间内是唯一的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

GUID是否在100%的时间内是唯一的?

Is a GUID unique 100% of the time?

它会在多个线程中保持唯一性吗?

Will it stay unique over multiple threads?

推荐答案

每个生成的GUID不是 保证是唯一的,总的 唯一键的数量(2 128 或 3.4×10 38 )太大,以至于出现相同数字的概率 两次生成的很小.为了 例如,考虑可观察 宇宙,其中包含约5×10 22 星星然后每个星星都可以拥有 6.8×10 15 通用的GUID.

While each generated GUID is not guaranteed to be unique, the total number of unique keys (2128 or 3.4×1038) is so large that the probability of the same number being generated twice is very small. For example, consider the observable universe, which contains about 5×1022 stars; every star could then have 6.8×1015 universally unique GUIDs.

来自维基百科.

这些是有关如何制作GUID(用于.NET)以及如何在适当的情况下获得相同GUID的不错的文章.

These are some good articles on how a GUID is made (for .NET) and how you could get the same guid in the right situation.

https://ericlippert.com/2012/04/24 /guid-guide-part-one/

https://ericlippert.com/2012/04/30 /guid-guide-part-two/

https://ericlippert.com/2012/05/07 /guid-guide-part-three/

这篇关于GUID是否在100%的时间内是唯一的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆