Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only add method to Random._GLOBAL_RNG if it is defined #38

Merged
merged 1 commit into from
May 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
# 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
Loading