Skip to content

Commit 4f2dabd

Browse files
authored
fix some RNG handling after new default RNG in Julia (#23)
1 parent 9f4555b commit 4f2dabd

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/testset.jl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,11 @@ function testset_beginend(mod::Module, isfinal::Bool, pat::Pattern, id::Int64, d
498498
local oldrng = copy(RNG)
499499
try
500500
# RNG is re-seeded with its own seed to ease reproduce a failed test
501-
Random.seed!(RNG.seed)
501+
if VERSION >= v"1.7.0-DEV.1225"
502+
Random.seed!(Random.GLOBAL_SEED)
503+
else
504+
Random.seed!(RNG.seed)
505+
end
502506
let
503507
ts.timed = @stats $stats $(esc(tests))
504508
end
@@ -571,7 +575,11 @@ function testset_forloop(mod::Module, isfinal::Bool, pat::Pattern, id::Int64,
571575
local ts
572576
local RNG = default_rng()
573577
local oldrng = copy(RNG)
574-
Random.seed!(RNG.seed)
578+
if VERSION >= v"1.7.0-DEV.1225"
579+
Random.seed!(Random.GLOBAL_SEED)
580+
else
581+
Random.seed!(RNG.seed)
582+
end
575583
local tmprng = copy(RNG)
576584
try
577585
let

0 commit comments

Comments
 (0)