I have an Excel template file that I want to fill with data generated by Stata 16.
As I want to run multiple instances of Stata at a time I try to copy the Excel template file first, with a unique suffix added and then write on the copied file.
So I copy the file with a random integer added (that has an upper bound so high that it is extremely unlikely to have two files named identically):
Code:
* Random id for temporary Excel export file global excelId = runiformint(1, 9999999) display $excelId * Copy to temporary export file copy "input.xlsx" "temporary_${excelId}.xlsx", replace
What I tried next: set a seed from current date and time
Code:
* Random id for temporary Excel export file local seed = tc(`c(current_date' `c(current_time)') set seed `seed' global excelId = runiformint(1, 9999999) display $excelId * Copy to temporary export file copy "input.xlsx" "temporary_${excelId}.xlsx", replace
The help is silent on setting a pseudorandom seed. Is there an option to avoid use of a seed?
My random numbers do not need to be repoducible, they even should not be!
I appreciate your help!
0 Response to Generating random numbers without seed
Post a Comment