-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
overloads for combinatorics.jl methods that accept rng's as parameters #10345
Labels
domain:randomness
Random number generation and the Random stdlib
Comments
Yes, I would like to see all methods which use |
simonbyrne
added a commit
to simonbyrne/julia
that referenced
this issue
Feb 27, 2015
…#10345). Also utilise randexp instead of taking log.
simonbyrne
added
the
domain:randomness
Random number generation and the Random stdlib
label
Feb 27, 2015
simonbyrne
added a commit
to simonbyrne/julia
that referenced
this issue
Mar 10, 2015
…#10345). Also utilise randexp instead of taking log.
simonbyrne
added a commit
to simonbyrne/julia
that referenced
this issue
Mar 12, 2015
…#10345). Also utilise randexp instead of taking log.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It would be cool if we had some overloads for functions in combinatorics.jl (like randperm and shuffle) that accept an rng as an argument.
Using the global rng works fine 99% of the time, but that 1%! Gah!
Here's a contrived example:
# seed the global rng
srand(42)
# do something random a non-deterministic number of times
for line in lines_in_a_file shuffle(collect(1:10)) end
# later, do a shuffle on something unrelated
shuffle(collect(1:10))
Global seeding is great, but if you invoke rand() a non-deterministic number of times... well the global rng is a non-deterministic state there on out, so you can't really get deterministic behaviour out of it unless you reinitialize it like so:
srand(42)
.I guess that's fine, but doesn't that approach break down when you get into distributed computation?
Anywho, I'm trying to make a case for always including overloads that accept an rng, in any method, not sure how successful the point is coming across.
I'm happy to pick it up as an issue unless someone else would rather give it a shot.
The text was updated successfully, but these errors were encountered: