0
$\begingroup$

Background

I am trying to do a reproducible scientific analysis. My conclusions are not dependent on the random number generator, but the RNG does change the results ~1% between runs. I would like to define starting points for the RNG algorithm to reproduce the same result each time.

I am using the "Mersenne-Twister" algorithm only because it is the default in R.

I am using the RNG to sample parameter values from their distributions and I need about $10^7$ values for the complete analysis.

Question

Are there any consequences of the choice of a starting value? Intuitively, R's set.seed(0) feels very non-random, but rationally, I can't imagine why this would matter.

  • 0
    If you do not like the look of `set.seed(0)` then try something else like `set.seed(2018)` but in fact you want the seed to appear to be arbitrary, since when using something like `set.seed(26689)` there may be a suspicion you tried several seeds in order to find one producing a particular result2018-06-15

1 Answers 1

4

Depending on the algorithm the seed can indeed affect the quality of your random numbers however due to the design of mersenne twister the choice of the seed shouldn't really affect the length of the periodicity of the random numbers or their quality. Still there might be some implementations of the mersenne twister where the seed does matter as you can read here ( http://library.gnome.org/devel/glib/unstable/glib-Random-Numbers.html ) Obviously they changed the seeding algorithm because the first one could result in bad seeds. If you want to be on the safe side use a reliable library for your random numbers.

You might want to try something like this for getting the seed: http://www.stanford.edu/~blp/writings/clc/random-seed.html

Note that if you don't need too many numbers you could download real random numbers generated from atmospheric noise here: http://www.random.org/

  • 0
    The impact of the seed should be in par with the Monte Carlo variability if the RNG is proper.2018-02-06