This question is similar(but not the same!) as the following questions...
Different sample results using set.seed command?
Is set.seed consistent over different versions of R (and Ubuntu)?
Same seed, different OS, different random numbers in R
... in which RNGkind()
is recommended in scripts to guarantee consistency between OS / R versions when setting the seed with set.seed()
However, I have found that in order to reproduce results on the unix and windows systems I'm using, I have to set RNGkind(sample.kind = "Rounding")
when running on Windows but not on unix. If I set it on both, I can't reproduce the result.
Can anyone explain this discrepancy in the systems? And how does one share code with set.seed() and ensure it's reproducible without knowing the end users' OS?
Many thanks
EDIT: I am having this problem using the kmeans()
function. I set.seed(1)
prior to each use of kmeans()