JuliaRandom / JuliaRandom/StableRNGs.jl
Documentation: Clarify that to use StableRNGs one must give a `rng` to every `rand()` call instead of setting Random.seed!()
- Dominant language
- Julia
- Stars
- 76
- Forks
- 10
- Avg merge
- 20m
- Merged PRs (30d)
- 1
Description
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:
```Julia
Random.seed!(1)
rand()
```
It should be:
```Julia
using StableRNGs
rng = StableRNG(1) # Note that we don't use `Random.seed!()` anymore as it is redundant.
rand(rng,)
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.