You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove Random.seed! from test suite, use Xoshiro/StableRNG instead (#2779)
Closes#2726
Global state is bad, so I went through the test suite and replaced all
`Random.seed!` calls with local alternatives.
The replacement depends on what the test actually needs:
- If the test only checks that results are roughly correct (using
`atol=`
or helpers like `check_gdemo`), I used `Xoshiro` passed directly to
`sample`.
- If the test checks exact reproducibility (using `==` or `isequal`),
I used `StableRNG` instead.
- If the seed was before optimization code like MLE/MAP (which is
deterministic anyway), I just deleted it.
- For `MCMCThreads` tests that reset the same rng between runs, I kept
the `Random.seed!(rng, seed)` pattern since that's already using an
explicit rng and not global state.
I left the single `Random.seed!` in `runtests.jl` untouched since
that one is intentional (as discussed in the issue).
---------
Co-authored-by: Penelope Yong <penelopeysm@gmail.com>
0 commit comments