Skip to content

Commit

Permalink
Use different seed
Browse files Browse the repository at this point in the history
  • Loading branch information
devmotion committed May 31, 2022
1 parent b3705a2 commit 83df967
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/sample.jl
Expand Up @@ -494,7 +494,7 @@

@testset "Thin chain by a factor of `thinning`" begin
# Run a thinned chain with `N` samples thinned by factor of `thinning`.
Random.seed!(1234)
Random.seed!(100)
N = 100
thinning = 3
chain = sample(MyModel(), MySampler(), N; thinning=thinning)
Expand All @@ -504,9 +504,10 @@
# Repeat sampling without thinning.
# On Julia < 1.6 progress logging changes the global RNG and hence is enabled here.
# https://github.com/TuringLang/AbstractMCMC.jl/pull/102#issuecomment-1142253258
Random.seed!(1234)
Random.seed!(100)
ref_chain = sample(MyModel(), MySampler(), N * thinning; progress=VERSION < v"1.6")
@test all(chain[i].a === ref_chain[(i - 1) * thinning + 1].a for i in 1:N)
@test all(chain[i].b === ref_chain[(i - 1) * thinning + 1].b for i in 1:N)
end

@testset "Sample without predetermined N" begin
Expand Down

0 comments on commit 83df967

Please sign in to comment.