Skip to content

Commit 507b454

Browse files
committed
use a default RNG from RandomDevice initialized at startup
1 parent 726b4f4 commit 507b454

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

stdlib/UUIDs/src/UUIDs.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ const namespace_url = UUID(0x6ba7b8119dad11d180b400c04fd430c8) # 6ba7b811-9dad-
3535
const namespace_oid = UUID(0x6ba7b8129dad11d180b400c04fd430c8) # 6ba7b812-9dad-11d1-80b4-00c04fd430c8
3636
const namespace_x500 = UUID(0x6ba7b8149dad11d180b400c04fd430c8) # 6ba7b814-9dad-11d1-80b4-00c04fd430c8
3737

38+
uuid_rng = Random.RandomDevice()
39+
3840
"""
3941
uuid1([rng::AbstractRNG=Random.RandomDevice()]) -> UUID
4042
@@ -53,7 +55,7 @@ UUID("cfc395e8-590f-11e8-1f13-43a2532b2fa8")
5355
!!! compat "Julia 1.6"
5456
The default rng has been changed to use Random.RandomDevice as of Julia 1.6
5557
"""
56-
function uuid1(rng::AbstractRNG=Random.RandomDevice())
58+
function uuid1(rng::AbstractRNG=uuid_rng)
5759
u = rand(rng, UInt128)
5860

5961
# mask off clock sequence and node
@@ -92,7 +94,7 @@ UUID("196f2941-2d58-45ba-9f13-43a2532b2fa8")
9294
!!! compat "Julia 1.6"
9395
The default rng has been changed to use Random.RandomDevice as of Julia 1.6
9496
"""
95-
function uuid4(rng::AbstractRNG=Random.RandomDevice())
97+
function uuid4(rng::AbstractRNG=uuid_rng)
9698
u = rand(rng, UInt128)
9799
u &= 0xffffffffffff0fff3fffffffffffffff
98100
u |= 0x00000000000040008000000000000000

0 commit comments

Comments
 (0)