Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Random seed revisited - how to get random seeds more efficiently?


From   "Tiago V. Pereira" <[email protected]>
To   [email protected]
Subject   st: Random seed revisited - how to get random seeds more efficiently?
Date   Tue, 30 Sep 2008 21:00:39 -0300 (BRT)

Dear all,

I have used the following random seed generator:

*/---------------START--------------------
tokenize "`c(current_date)'" ,parse(" ")
local seed_1 "`1'"
tokenize "`c(current_time)'" ,parse(":")
local seed_2 "`1'`3'`5'"
local seed_final "`seed_1'`seed_2'"
set seed `seed_final'
*/--------------END-----------------------

I suspect that for loops that take less than 1 second, I am using actually
the same seed for 2-5 loops (it is just a guess). Do you know more
effective (pseudo)random seed generators?

Thanks for your time!

Cheers!

Tiago





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