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

Documentation: Clarify that to use StableRNGs one must give a rng to every rand() call instead of setting Random.seed!() #13

Open
eirikbrandsaas opened this issue Aug 26, 2022 · 0 comments
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers

Comments

@eirikbrandsaas
Copy link

Hi, thanks for this package. Very useful as my computational cluster doesn't update Julia frequently.

Issue:
I think many just set Random.seed!() and forget about it. Then for some reason they need to use StableRNGs, at which point the natural starting point is something like Random.seed!(StableRNG(seed::Integer)) which doesn't work. (e.g., https://discourse.julialang.org/t/random-seed-lts-vs-latest-stable/64370).

The usage section could maybe just have an extra subsection at the end of readme.md, along the lines of:

Moving from Random.seed!() to StableRNGs

If you in previous code used `Random.seed!() to get the same random numbers, you most now modify all calls that generate random numbers. For example, if your old code was:

Random.seed!(1)
rand()

It should be:

using StableRNGs
rng = StableRNG(1) # Note that we don't use `Random.seed!()` anymore as it is redundant.
rand(rng,)
@rfourquet rfourquet added documentation Improvements or additions to documentation good first issue Good for newcomers labels Sep 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants