Random seed LTS vs latest stable

I am testing the same package on two different environments (LTS and current stable). I have noticed that the default random number generator is different. How do I change it on either environment to get the same sequence of random numbers? Ideally, I would like to change it on the environment with current stable release.

GitHub - JuliaRandom/StableRNGs.jl: A Julia RNG with stable streams is designed for this

2 Likes

Thank you. Silly question - do I need to have it on both environments? I am asking since I already have a series of test results based on the default LTS random number generator.

Yes

Before trying this package, I would prefer to explore other options. I do not need a high decimal precision for this series of tests. Thus, somewhat ad-hoc solutions might work.

I have decided to use StableRNGs at the end. The main issue is that I need to pass rng to randn, but I cannot find a way to simply set Random.seed! as usual.

That’s not a problem, it’s actually good to be explicit about the RNG used: accessing the global default RNG takes time, if you do that very often it adds up: The need for rand speed | Blog by Bogumił Kamiński

2 Likes

Thanks. I understand that, but I need it only for a series of fast tests where the performance loss would be minimal - it would actually take much longer to re-write them with this change. However, I guess I have no other option, but making this change :slight_smile:

Hi all, to bring this question back up: I am currently working on an R-wrapper package of @droodman 's WildBootTests.jl, which handles random seeding via StableRNGs. For my use case, it would be great if I could allow users to set a ‘global’ random seed as via Random.Seed!(). Asking users to supply a specific seed value every time they run a bootstrap seems a little inefficient in terms of programmer vs computing time :slight_smile:
Thanks for your help!
Best, Alex