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

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?

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

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

2 Likes

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

Check out GitHub - JuliaRandom/StableRNGs.jl: A Julia RNG with stable streams,

1 Like