0

Lets say in my system I set seed as set.seed(123). It will select some random rows from my data. Will it select the same data as mine if we use the same code on different machine using same data?

set.seed(123)
sample(1:6, 10, replace=TRUE)

I am getting below results..

sample(1:6, 10, replace=TRUE)
[1] 2 5 3 6 6 1 4 6 4 3

If I run this same code from different system then will i get the same results or different results?

Harshal Gajare
  • 605
  • 4
  • 16
  • Yes, it will be the same, that is why we use `set.seed`. – zx8754 Jan 09 '19 at 13:08
  • 1
    It depends. For the specific example here almost certainly the answer is "yes". For more complex algorithms reproducibility can depend on the OS and even the hardware. There is a reason why people for whom reproducibility is extremely important archive the hardware used for the computations. – Roland Jan 09 '19 at 13:09
  • Actually, reference to the post is wrong, you have to read https://stackoverflow.com/questions/48626086/same-seed-different-os-different-random-numbers-in-r – Severin Pappadeux Jan 09 '19 at 16:18

0 Answers0