# Why Random.seed!(123) don't produce the same result?

**URL:** <https://discourse.julialang.org/t/why-random-seed-123-dont-produce-the-same-result/98848>\
**Category:** General Usage\
**Tags:** question, random\
**Created:** [May 14, 2023, 9:24pm UTC](https://discourse.julialang.org/t/why-random-seed-123-dont-produce-the-same-result/98848 "2023-05-14T21:24:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Optimization](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/optimization/32/32462_2.png) [@Optimization](https://discourse.julialang.org/u/Optimization)\
**Post date:** [May 14, 2023, 9:24pm UTC](https://discourse.julialang.org/t/why-random-seed-123-dont-produce-the-same-result/98848/1 "2023-05-14T21:24:45Z")

</div>

How to force `rand` to generate the same thing every single time?  
I wish to create a random list of 100 numbers between 200 and 500 and due to reproduceablity I wish to use random seed. But running the follwoing gives me differnt 100 numbers each time I run and print R! why?

```julia
L = 185
Random.seed!(123)
R = rand(200:500, L)

```

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [May 14, 2023, 9:36pm UTC](https://discourse.julialang.org/t/why-random-seed-123-dont-produce-the-same-result/98848/2 "2023-05-14T21:36:14Z")

</div>

On my computer it gives ther same result every time if I re-run all three lines. If you only re-run the last line, you will get different results because the random number generator you seeded with 123 will keep evolving. Does that answer your question?

For more information: [Random Numbers · The Julia Language](https://docs.julialang.org/en/v1/stdlib/Random/)

---

<div class="post-metadata">

**Author:** ![e3c6](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Post date:** [May 14, 2023, 9:49pm UTC](https://discourse.julialang.org/t/why-random-seed-123-dont-produce-the-same-result/98848/3 "2023-05-14T21:49:30Z")

</div>

Julia random streams are not guaranteed to be stable across Julia versions.

Check out [GitHub - JuliaRandom/StableRNGs.jl: A Julia RNG with stable streams](https://github.com/JuliaRandom/StableRNGs.jl),
