# Consequences of choice of a seed for random number generating algorithm?

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.

-

## 1 Answer

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/

-
With real random numbers, I don't think his computations will be reproducibly the same every single time. –  Willie Wong Jan 14 '11 at 20:25
Actually he could include the dataset he used into his project so it is reproducable. –  Listing Jan 14 '11 at 20:27
@user3123: technically true, but in that case wouldn't getting any pseudorandom string of 10^7 numbers do just as well? :) –  Willie Wong Jan 14 '11 at 20:54
Indeed, he should just use a reliable opensource library like boost::random that has been intensively tested and reference his seed. Actually 0 is ok too. –  Listing Jan 14 '11 at 20:57