-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
faster rand(::Tuple) #32208
faster rand(::Tuple) #32208
Conversation
This was an oversight. This makes rand(::MersenneTwister, ::Tuple) generally faster.
d02b695
to
59b56ce
Compare
According to recent documentation, it's fine to change generated streams of random numbers for a given seed. Removing |
No, this is precisely what the "minor change" label is for: changes that are allowed in minor releases but not in patch releases. We do not promise random stream stability but we will not change the behavior of programs in point releases except to fix bugs. |
I've added the "needs news" label because minor changes should always be mentioned in NEWS. |
Oops, sorry, I misunderstood! News added at #33404. |
The idea is quite simple:
L
, we do like for length 4, i.e. use a mask:rand(UInt32) & (L-1)
rand(Base.OneTo(n))
(used inrand(::Tuple)
) slower thanrand(1:n)
forMersenneTwister
.This breaks the reproducibility of generated streams, but we now have a precedent for that.