Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: Setting same seed, getting different random numbers.


From   Patrick Roland <patrick.rolande@gmail.com>
To   statalist@hsphsun2.harvard.edu
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
mata
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?

Thanks.
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index