# Same code but different values of simulation from two computers

**URL:** <https://discourse.julialang.org/t/same-code-but-different-values-of-simulation-from-two-computers/103562>\
**Category:** New to Julia\
**Tags:** random\
**Created:** [September 6, 2023, 9:11am UTC](https://discourse.julialang.org/t/same-code-but-different-values-of-simulation-from-two-computers/103562 "2023-09-06T09:11:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zerosum](https://avatars.discourse-cdn.com/v4/letter/z/b2d939/32.png) [@Zerosum](https://discourse.julialang.org/u/Zerosum)\
**Post date:** [September 6, 2023, 9:11am UTC](https://discourse.julialang.org/t/same-code-but-different-values-of-simulation-from-two-computers/103562/1 "2023-09-06T09:11:07Z")

</div>

I have a laptop and a desktop. Both are Mac with M1 chip.

I wrote down my codes in my desktop and transferred to my laptop.

However, if I run my codes, I get different results.

1. I run several times in both computers to see if there is a racing problem with my multithreading. Within each computer, the results are always same.

2. I just wrote down Random.seed!(1234) and tried rand(). Both computers give me the result.

What could possibly generate this?

Thank you very much

---

<div class="post-metadata">

**Author:** ![mrufsvold](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mrufsvold/32/31600_2.png) [@mrufsvold](https://discourse.julialang.org/u/mrufsvold)\
**Post date:** [September 6, 2023, 10:54am UTC](https://discourse.julialang.org/t/same-code-but-different-values-of-simulation-from-two-computers/103562/2 "2023-09-06T10:54:45Z")

</div>

Hard to say without any code to look at. If you can get a minimum working example (MWE) that reproduces the different result on each machine, it will be much more productive for us to help!

---

<div class="post-metadata">

**Author:** ![Rudi79](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rudi79/32/3884_2.png) [@Rudi79](https://discourse.julialang.org/u/Rudi79)\
**Post date:** [September 6, 2023, 11:43am UTC](https://discourse.julialang.org/t/same-code-but-different-values-of-simulation-from-two-computers/103562/3 "2023-09-06T11:43:53Z")

</div>

Which order of magnitude of differences are we talking about? Do you use the same julia and package versions?

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [September 6, 2023, 2:27pm UTC](https://discourse.julialang.org/t/same-code-but-different-values-of-simulation-from-two-computers/103562/4 "2023-09-06T14:27:59Z")

</div>

Are they running the same versions of Julia?

You might need to use a different psuedo-random number generator if you need stability.

> **[GitHub - JuliaRandom/StableRNGs.jl: A Julia RNG with stable streams](https://github.com/JuliaRandom/StableRNGs.jl)**
>
> A Julia RNG with stable streams. Contribute to JuliaRandom/StableRNGs.jl development by creating an account on GitHub.
