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

RNG: fix Sampler selection for GLOBAL_RNG #33172

Merged
merged 1 commit into from
Sep 6, 2019

Conversation

rfourquet
Copy link
Member

@rfourquet rfourquet commented Sep 5, 2019

Fix #33170.

@rfourquet rfourquet added bugfix This change fixes an existing bug randomness Random number generation and the Random stdlib labels Sep 5, 2019
Sampler(rng::AbstractRNG, ::Type{X}, r::Repetition=Val(Inf)) where {X} = Sampler(_typeof(rng), X, r)

# GLOBAL_RNG currently represents a MersenneTwister
_typeof(x) = typeof(x)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe call this typeof_rng instead? _typeof sounds much more general.


# GLOBAL_RNG currently represents a MersenneTwister
typeof_rng(rng::AbstractRNG) = typeof(rng)
typeof_rng(::_GLOBAL_RNG) = MersenneTwister
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_GLOBAL_RNG is not defined here yet.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right, is this why CI didn't build? I couldn't understand CI failures (am still used to travis interface).

@KristofferC KristofferC added this to the 1.3 milestone Sep 5, 2019
@KristofferC KristofferC merged commit 4c8cd3b into master Sep 6, 2019
@delete-merged-branch delete-merged-branch bot deleted the rf/rng/fix-Sampler-typeof branch September 6, 2019 09:36
KristofferC pushed a commit that referenced this pull request Sep 6, 2019
@KristofferC KristofferC mentioned this pull request Sep 6, 2019
36 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This change fixes an existing bug randomness Random number generation and the Random stdlib
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Random Sampler selection got broken with thread safe RNG change
3 participants