Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Query on -set seed-


From   wgould@stata.com (William Gould, Stata)
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Query on -set seed-
Date   Tue, 08 Feb 2005 08:14:57 -0600

Roger Newson <roger.newson@kcl.ac.uk> asked what happens if you -set seed- to
a number larger than 2^31-1, the documented maximum value of the seed.  He
suspects a bug and he is right.

I have reviewed the code:  

    1.  The value of the seed is set to memory junk; said differently,
        a 4-byte area of memory containing the random-number 
        seed is left uninitialized.  You type -set seed <x>-, 
        <x> > 2^31-1, and it does not matter what number you type, 
        the value of the seed will be memory junk.

    2.  Memory junk is as good as any other seed, randomnumberwise.

    3.  However, memory junk is not reproducible.  Type -set seed <x>- 
        later, specifying the same value for <x> > 2^31-1, and the 
        4-byte area that contains the seed will be left uninitialized 
        again.  Perhaps, since the last time you set the seed, something 
        unrelated was rewritten in that area, or perhaps the area still 
        contains the same value.  In the latter case, you will be fooled 
        into thinking the the -set seed- is reproducible.

We will treat this as a bug.  In the future, Stata will issue an error
message when you attempt to set a seed greater than 2^31-1.

-- Bill
wgould@stata.com
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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   |   What's new   |   Site index