这会导致多个相同的GUID吗? [英] Could this cause multiple identical GUIDs?

查看:70
本文介绍了这会导致多个相同的GUID吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于GUID的生成与时间有关,因此如果在不同线程上的同一时刻多次调用System.Guid.NewGuid(),是否可以返回相同的GUID?

As GUID generation is time-dependent, if System.Guid.NewGuid() is called multiple times at the exact same instant on different threads, could it return identical GUIDs?

推荐答案

在Windows上,GUID(UUID)是使用 UuidCreate 。它们是根据 RFC 4122 的版本4 UUID。除非您使用的是使用 UuidCreateSequential

On Windows, GUIDs (UUIDs) are created from a cryptographic random number generator with UuidCreate. They are version 4 UUIDs in terms of RFC 4122. No timestamps or ethernet cards are involved, unless you're using old school version 1 GUIDs created with UuidCreateSequential.

另请参见 System.Guid.NewGuid()的随机性如何? (两个)

这篇关于这会导致多个相同的GUID吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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