Skip to content

Commit

Permalink
only add method to Random._GLOBAL_RNG if it is defined
Browse files Browse the repository at this point in the history
This was removed in Julia 1.11+
  • Loading branch information
KristofferC authored May 9, 2024
1 parent cbb26c2 commit 5e31175
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/ensembles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,9 @@ end
# Random._GLOBAL_RNG() and Random.default_rng() are threadsafe by default_rng
# as they have thread local state from julia >=1.3<=1.6 and task local state Julia >=1.7
threadsafe_rng(rng::typeof(Random.default_rng())) = rng
threadsafe_rng(rng::Random._GLOBAL_RNG) = rng
if isdefined(Random, :_GLOBAL_RNG)
threadsafe_rng(rng::Random._GLOBAL_RNG) = rng

Check warning on line 416 in src/ensembles.jl

View check run for this annotation

Codecov / codecov/patch

src/ensembles.jl#L416

Added line #L416 was not covered by tests
end
threadsafe_rng(rng) = deepcopy(rng)

function _fit(res::CPUThreads, func, verbosity, stuff)
Expand Down

0 comments on commit 5e31175

Please sign in to comment.