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

st: RE: "random" seed for uniform()


From   "Donovan Crew" <[email protected]>
To   <[email protected]>
Subject   st: RE: "random" seed for uniform()
Date   Wed, 22 Oct 2003 21:59:53 -0500

>J. Michael Oakes wrote:
>
>Using Stata 8, I want to have a different seed each time I call an *.ado
>file with uniform() in it. I recall setting seed to 'system time' in SAS
and
>in Stata... I think... and that worked well.


This will use your system time for the seed:

local holdseed = real(substr(c(current_time),1,2) +
substr(c(current_time),4,2) + substr(c(current_time),7,2))

set seed `holdseed'

gen random = uniform()

macro drop holdseed



Donovan Crew

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index