# Random seed LTS vs latest stable

**URL:** https://discourse.julialang.org/t/random-seed-lts-vs-latest-stable/64370
**Category:** General Usage
**Tags:** testing
**Created:** [July 9, 2021, 5:44pm UTC](https://discourse.julialang.org/t/random-seed-lts-vs-latest-stable/64370 "2021-07-09T17:44:26Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![fipelle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fipelle/32/4772_2.png) [@fipelle](https://discourse.julialang.org/u/fipelle)
#### Post date: [July 9, 2021, 5:44pm UTC](https://discourse.julialang.org/t/random-seed-lts-vs-latest-stable/64370/1 "2021-07-09T17:44:26Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)
#### Post date: [July 9, 2021, 5:52pm UTC](https://discourse.julialang.org/t/random-seed-lts-vs-latest-stable/64370/2 "2021-07-09T17:52:43Z")

</div>

[GitHub - JuliaRandom/StableRNGs.jl: A Julia RNG with stable streams](https://github.com/JuliaRandom/StableRNGs.jl) is designed for this

---

<div class="post-metadata">

### Author: ![fipelle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fipelle/32/4772_2.png) [@fipelle](https://discourse.julialang.org/u/fipelle)
#### Post date: [July 9, 2021, 5:59pm UTC](https://discourse.julialang.org/t/random-seed-lts-vs-latest-stable/64370/3 "2021-07-09T17:59:31Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)
#### Post date: [July 9, 2021, 6:00pm UTC](https://discourse.julialang.org/t/random-seed-lts-vs-latest-stable/64370/4 "2021-07-09T18:00:00Z")

</div>

Yes

---

<div class="post-metadata">

### Author: ![fipelle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fipelle/32/4772_2.png) [@fipelle](https://discourse.julialang.org/u/fipelle)
#### Post date: [July 9, 2021, 6:03pm UTC](https://discourse.julialang.org/t/random-seed-lts-vs-latest-stable/64370/5 "2021-07-09T18:03:26Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![fipelle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fipelle/32/4772_2.png) [@fipelle](https://discourse.julialang.org/u/fipelle)
#### Post date: [August 11, 2021, 3:46pm UTC](https://discourse.julialang.org/t/random-seed-lts-vs-latest-stable/64370/6 "2021-08-11T15:46:12Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)
#### Post date: [August 11, 2021, 3:49pm UTC](https://discourse.julialang.org/t/random-seed-lts-vs-latest-stable/64370/7 "2021-08-11T15:49:11Z")

</div>

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](https://bkamins.github.io/julialang/2020/11/20/rand.html)

---

<div class="post-metadata">

### Author: ![fipelle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fipelle/32/4772_2.png) [@fipelle](https://discourse.julialang.org/u/fipelle)
#### Post date: [August 11, 2021, 3:54pm UTC](https://discourse.julialang.org/t/random-seed-lts-vs-latest-stable/64370/8 "2021-08-11T15:54:31Z")

</div>

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 🙂

---

<div class="post-metadata">

### Author: ![s3alfisc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/s3alfisc/32/35474_2.png) [@s3alfisc](https://discourse.julialang.org/u/s3alfisc)
#### Post date: [April 16, 2022, 3:58pm UTC](https://discourse.julialang.org/t/random-seed-lts-vs-latest-stable/64370/9 "2022-04-16T15:58:16Z")

</div>

Hi all, to bring this question back up: I am currently working on an [R-wrapper](https://github.com/s3alfisc/fwildclusterboot) package of @droodman 's [WildBootTests.jl](https://github.com/droodman/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 🙂  
Thanks for your help!  
Best, Alex
