Skip to content

Commit

Permalink
Merge pull request #38 from KristofferC/kc/1.11_compat
Browse files Browse the repository at this point in the history
only add method to `Random._GLOBAL_RNG` if it is defined
  • Loading branch information
ablaom authored May 9, 2024
2 parents cbb26c2 + 5e31175 commit 77c2ad7
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
end
threadsafe_rng(rng) = deepcopy(rng)

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

0 comments on commit 77c2ad7

Please sign in to comment.