@@ -36,12 +36,21 @@ const namespace_oid = UUID(0x6ba7b8129dad11d180b400c04fd430c8) # 6ba7b812-9dad-
3636const namespace_x500 = UUID (0x6ba7b8149dad11d180b400c04fd430c8 ) # 6ba7b814-9dad-11d1-80b4-00c04fd430c8
3737
3838"""
39- uuid1([rng::AbstractRNG=GLOBAL_RNG ]) -> UUID
39+ uuid1([rng::AbstractRNG]) -> UUID
4040
4141Generates a version 1 (time-based) universally unique identifier (UUID), as specified
4242by RFC 4122. Note that the Node ID is randomly generated (does not identify the host)
4343according to section 4.5 of the RFC.
4444
45+ The default rng used by `uuid1` is not `GLOBAL_RNG` and every invocation of `uuid1()` without
46+ an argument should be expected to return a unique identifier. Importantly, the outputs of
47+ `uuid1` do not repeat even when `Random.seed!(seed)` is called. Currently (as of Julia 1.6),
48+ `uuid1` uses `Random.RandomDevice` as the default rng. However, this is an implementation
49+ detail that may change in the future.
50+
51+ !!! compat "Julia 1.6"
52+ The output of `uuid1` does not depend on `GLOBAL_RNG` as of Julia 1.6.
53+
4554# Examples
4655```jldoctest; filter = r"[a-z0-9]{8}-([a-z0-9]{4}-){3}[a-z0-9]{12}"
4756julia> rng = MersenneTwister(1234);
@@ -50,7 +59,7 @@ julia> uuid1(rng)
5059UUID("cfc395e8-590f-11e8-1f13-43a2532b2fa8")
5160```
5261"""
53- function uuid1 (rng:: AbstractRNG = Random. default_rng ())
62+ function uuid1 (rng:: AbstractRNG = Random. RandomDevice ())
5463 u = rand (rng, UInt128)
5564
5665 # mask off clock sequence and node
@@ -74,11 +83,20 @@ function uuid1(rng::AbstractRNG=Random.default_rng())
7483end
7584
7685"""
77- uuid4([rng::AbstractRNG=GLOBAL_RNG ]) -> UUID
86+ uuid4([rng::AbstractRNG]) -> UUID
7887
7988Generates a version 4 (random or pseudo-random) universally unique identifier (UUID),
8089as specified by RFC 4122.
8190
91+ The default rng used by `uuid4` is not `GLOBAL_RNG` and every invocation of `uuid4()` without
92+ an argument should be expected to return a unique identifier. Importantly, the outputs of
93+ `uuid4` do not repeat even when `Random.seed!(seed)` is called. Currently (as of Julia 1.6),
94+ `uuid4` uses `Random.RandomDevice` as the default rng. However, this is an implementation
95+ detail that may change in the future.
96+
97+ !!! compat "Julia 1.6"
98+ The output of `uuid4` does not depend on `GLOBAL_RNG` as of Julia 1.6.
99+
82100# Examples
83101```jldoctest
84102julia> rng = MersenneTwister(1234);
@@ -87,7 +105,7 @@ julia> uuid4(rng)
87105UUID("196f2941-2d58-45ba-9f13-43a2532b2fa8")
88106```
89107"""
90- function uuid4 (rng:: AbstractRNG = Random. default_rng ())
108+ function uuid4 (rng:: AbstractRNG = Random. RandomDevice ())
91109 u = rand (rng, UInt128)
92110 u &= 0xffffffffffff0fff3fffffffffffffff
93111 u |= 0x00000000000040008000000000000000
0 commit comments