Random number and parallel execution

I think it’s generally fine.

Explicitly passing an RNG to sim code is useful is you want:

2 Likes

I’d also add testing (which is kind of related to reproducibility): StableRNGs.jl is very useful to test packages across multiple minor versions of Julia, since the default RNG can (and did) change the stream of generated numbers from version to version. Having a mechanism to easily pass the RNG is very important.

4 Likes

The other option is to wait until 1.7 and hope https://github.com/JuliaLang/julia/pull/34852 gets in. If it does, (and I understand it correctly) it should fix the speed of rand() without passing the rng (and be faster since it uses a faster rng also)

1 Like

+1 , I’m using that already.

FYI, I just added a section discussing a couple of approaches for using RNG in FLoops.jl documentation: How to do X in parallel? · FLoops. Some approaches are generic (don’t need a particular package) and one requires something like FLoops.jl (esp. a new release https://github.com/JuliaRegistries/General/pull/31964).

6 Likes