# Is rand guaranteed to give the same sequence of random numbers in every machine (with the same seed)?

**URL:** https://discourse.julialang.org/t/is-rand-guaranteed-to-give-the-same-sequence-of-random-numbers-in-every-machine-with-the-same-seed/12344
**Category:** General Usage
**Tags:** question
**Created:** [July 12, 2018, 9:00pm UTC](https://discourse.julialang.org/t/is-rand-guaranteed-to-give-the-same-sequence-of-random-numbers-in-every-machine-with-the-same-seed/12344 "2018-07-12T21:00:32Z")
**Posts on this page:** 4
**Page:** 1

<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: [July 12, 2018, 9:00pm UTC](https://discourse.julialang.org/t/is-rand-guaranteed-to-give-the-same-sequence-of-random-numbers-in-every-machine-with-the-same-seed/12344/1 "2018-07-12T21:00:32Z")

</div>

Suppose I seed the random number generator `srand(1)`, and then generate many pseudo-random numbers via `rand`. Is there a guarantee that I will always obtain the same sequence of pseudo-random numbers in different machines?

---

<div class="post-metadata">

### Author: ![sunoru](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sunoru/32/461_2.png) [@sunoru](https://discourse.julialang.org/u/sunoru)
#### Post date: [July 13, 2018, 6:55am UTC](https://discourse.julialang.org/t/is-rand-guaranteed-to-give-the-same-sequence-of-random-numbers-in-every-machine-with-the-same-seed/12344/2 "2018-07-13T06:55:22Z")

</div>

Yes, as long as they have the same version of Julia.

---

<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: [July 13, 2018, 7:21am UTC](https://discourse.julialang.org/t/is-rand-guaranteed-to-give-the-same-sequence-of-random-numbers-in-every-machine-with-the-same-seed/12344/3 "2018-07-13T07:21:13Z")

</div>

I think this guarantee should be stated explicitly in the documentation.

---

<div class="post-metadata">

### Author: ![rfourquet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rfourquet/32/3610_2.png) [@rfourquet](https://discourse.julialang.org/u/rfourquet)
#### Post date: [July 13, 2018, 5:42pm UTC](https://discourse.julialang.org/t/is-rand-guaranteed-to-give-the-same-sequence-of-random-numbers-in-every-machine-with-the-same-seed/12344/4 "2018-07-13T17:42:42Z")

</div>

I also believe it’s garanteed, as it uses a deterministic algorithm, although the library we use (dSFMT) doesn’t explicitlly mention that on their website (unless I missed it). On the Julia side, the only difference would be due to how we define `Int`: `rand(Int)` will depend on the architecture (calling `rand(Int32)` or `rand(Int64)`).
