Skip to content

Commit 7d0f535

Browse files
committed
Change to global rng
This maintains backwards compat with Julia 1.6
1 parent 265ee8e commit 7d0f535

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

test/inference/hmc.jl

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,6 @@ end
7676

7777
@testset "hmc metric behavior" begin
7878
import LinearAlgebra, Random
79-
80-
# RNG state for reproducibility
81-
# As per Julia 1.12 this can be passed to the testset but would fail ci
82-
rng=Random.Xoshiro(0x2e026445595ed28e)
8379

8480
# test that different metrics produce different behavior
8581
@gen function test_metric_effect()
@@ -92,13 +88,13 @@ end
9288

9389

9490
# Set RNG to a known state for comparison
95-
Random.seed!(rng, 1)
91+
Random.seed!(1)
9692

9793
# Run HMC with identity metric (default)
9894
(trace_identity, _) = hmc(trace1, select(:x, :y); L=5)
9995

10096
# Reset RNG to same state for comparison
101-
Random.seed!(rng, 1)
97+
Random.seed!(1)
10298

10399
# Run HMC with scaled metric (should behave differently)
104100
metric_scaled = [10.0, 0.1] # Very different scales
@@ -114,12 +110,12 @@ end
114110

115111
for i in 1:50
116112
# Reset to predictable state for each iteration
117-
Random.seed!(rng, i)
113+
Random.seed!(i)
118114
(_, accepted_diag) = hmc(trace1, select(:x, :y);
119115
metric=LinearAlgebra.Diagonal([2.0, 3.0]))
120116

121117
# Reset to same state for comparison
122-
Random.seed!(rng, i)
118+
Random.seed!(i)
123119
(_, accepted_dense) = hmc(trace1, select(:x, :y);
124120
metric=[2.0 0.0; 0.0 3.0])
125121

0 commit comments

Comments
 (0)