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

Re: st: Random number seed


From   [email protected]
To   [email protected]
Subject   Re: st: Random number seed
Date   Thu, 20 May 2004 15:30:30 +0100

You could use date and time as the seed...
Add the following lines to the start of your program if you are using STATA
8


tokenize "`c(current_time)'" ,parse(":")
local seed "`1'`3'`5'"
local edate = date("`c(current_date)'","dmy")
local seed "`edate'`seed'"
set seed `seed'

cheers
Ade

Adrian Mander MSc PhD, Principal Statistician, GlaxoSmithKline, Mail Code
HW8133, New Frontiers Science Park (South), Harlow, Essex, CM19 5AW. Tel:
01279 63 1203 Fax: 01279 64 4677


                                                                                                                                               
                      "Subhankar Nayak"                                                                                                        
                      <[email protected]>                                                                                                    
                                                                                                                                               
                      Sent by:                         To:      [email protected]                                                 
                      owner-statalist@hsphsun2.                                                                                                
                      harvard.edu                      cc:                                                                                     
                                                       Subject: st: Random number seed                                                         
                                                                                                                                               
                      20-May-2004 15:15                                                                                                        
                      Please respond to                                                                                                        
                      [email protected]                                                                                                
                      d.edu                                                                                                                    
                                                                                                                                               
                                                                                                                                               



Can the stata random number seed be itself randomized?

I am running a program called "market.do" in the batch mode without
invoking/opening stata. This program carries out an analysis based on a set
of 1,000 uniform random numbers it generates.

However, since the random seed is always the same everytime I run the
program in batch mode, I get the same set of 1,000 random numbers each time
I run this program in batch mode. Results are identical which defeats the
purpose.

Can this be changed?

Thanks,
Subh


*
*   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/







*
*   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