Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Setting same seed, getting different random numbers.

From   Patrick Roland <>
Subject   st: Setting same seed, getting different random numbers.
Date   Wed, 30 Nov 2011 13:29:11 -0800

I encountered a strange problem. I tried running the same code on two
different versions of Stata - one Stata/SE 12.0 on a server, and one
Stata/SE 11.2 on my own computer. Both generate normal random numbers
in mata with the same seed. But after a while the random numbers they
generate differ! The code is as follows

set seed 2
f = rnormal(1000000,1,0,1)

On the two machines, f[1,1] = .7005116833. But one one f[1000000,1] =
-.5182349644, and on the other it is .7083750352.

This strikes me as bizarre and impedes replication of my code across
computers. Any ideas as to what's going on here?

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index