-
-
Notifications
You must be signed in to change notification settings - Fork 297
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
Random.seed!
not reproducible
#2290
Comments
ps. This happens on Julia 1.7 and 1.8. On Julia 1.6 Pluto behaves like the REPL. |
The difference with 1.6 is caused by this change: JuliaLang/julia#40546. Each eval is made in a different task in Pluto, thus the RNG is not inherited. |
@Pangoraw thanks! Does that mean that this is the intended result? Should/could we change it? |
I would say that this is intentional, and the way to get reproducible RNG across cells is to create an RNG object and pass it to other cells. @Pangoraw WDYT? |
With the task based rng passing it explicitely does not work since the task local state is not preserved across cells: rng = Random.seed!(42)
randn(rng, 10) One workaround for reproducible randomness is to use the previous rng = Random.MersenneTwister(42)
randn(rng, 10) To fix inside pluto, we need to use a persistent task with an loop to execute cells like in IJulia for example: |
I expected the two random numbers to be the same, similarly as to what we see in the repl when we run
notebook.tar.gz
The text was updated successfully, but these errors were encountered: