Skip to content
This repository was archived by the owner on Jan 18, 2025. It is now read-only.

Commit af1eb7a

Browse files
authored
Merge pull request JuliaLang/julia#40546 from JuliaLang/jb/chethega/tlrng
task-local xoshiro rebased
2 parents 128d3ff + b2877ad commit af1eb7a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Test.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,7 +1277,7 @@ function testset_beginend(args, tests, source)
12771277
local oldrng = copy(RNG)
12781278
try
12791279
# RNG is re-seeded with its own seed to ease reproduce a failed test
1280-
Random.seed!(RNG.seed)
1280+
Random.seed!(Random.GLOBAL_SEED)
12811281
let
12821282
$(esc(tests))
12831283
end
@@ -1368,7 +1368,7 @@ function testset_forloop(args, testloop, source)
13681368
local ts
13691369
local RNG = default_rng()
13701370
local oldrng = copy(RNG)
1371-
Random.seed!(RNG.seed)
1371+
Random.seed!(Random.GLOBAL_SEED)
13721372
local tmprng = copy(RNG)
13731373
try
13741374
let
@@ -1839,7 +1839,7 @@ end
18391839

18401840
"`guardseed(f, seed)` is equivalent to running `Random.seed!(seed); f()` and
18411841
then restoring the state of the global RNG as it was before."
1842-
guardseed(f::Function, seed::Union{Vector{UInt32},Integer}) = guardseed() do
1842+
guardseed(f::Function, seed::Union{Vector{UInt64},Vector{UInt32},Integer,NTuple{4,UInt64}}) = guardseed() do
18431843
Random.seed!(seed)
18441844
f()
18451845
end

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ let code = quote
853853
end
854854

855855
@testset "@testset preserves GLOBAL_RNG's state, and re-seeds it" begin
856-
# i.e. it behaves as if it was wrapped in a `guardseed(GLOBAL_RNG.seed)` block
856+
# i.e. it behaves as if it was wrapped in a `guardseed(GLOBAL_SEED)` block
857857
seed = rand(UInt128)
858858
Random.seed!(seed)
859859
a = rand()

0 commit comments

Comments
 (0)