我工作的一个项目,我需要生成大约十亿的GUID。
I am working on a project where I need to generate approximately 1 billion GUIDs.
我知道的GUID不保证唯一性,但是是唯一的,几乎所有的时间。
I know GUIDs are not guaranteed to be unique but are unique almost all of the time.
如果我产生了十亿的GUID,那是什么会有一个匹配的概率是多少?
If I generated a billion GUIDs, what is the probability that there will be a match?
http://blogs.msdn.com/b/oldnewthing/archive/2008/06/27/8659071.aspx
在.NET GUID由
The .NET GUID consists of
在60位的时间戳, 在48位计算机的标识符, 唯一标志的14位,和 在六位固定因此,通过奥斯卡引述的UUID的概率并不在这里工作。但是,如果您从一台计算机所有的1十亿的GUID,就没有机会得到重复的(除非你在玩的时钟; - )
So the UUID probability quoted by Oscar does not work here. But if you create all your 1 billion GUIDs from one computer, there is no chance to get a duplicate (except you are playing with the clock ;-)