Dear stata list,
I am trying to create a simulation program in stata. In this simulation, I
would like to generate random numbers arising in various ranges, for example
numbers between 0 to10, 0 to15, 0 to 20, 20 to 10 etc for several variables
e.g. x1, x2, x3, x4 etc. Using the uniform distribution random number
generator I can generate random numbers 0 to 10, or 0 to 100 without any
problem by doing something like:
gen x1=int(10*uniform())
How can I generate random numbers from other ranges, for example 15 to 35
and how can I do this for several variables at once for example 5
observation with three variables as shown below for random numbers 1 to 10,
8 to 15 and 10 to 25 respectively as shown below
ob x1 x2 x3
1 3 12 21
2 9 8 18
3 0 10 11
4 10 10 25
5 4 14 19
Your help will be highly appreciated.
Best wishes,
Patrick
_________________________________________________________________
Be the first to hear what's new at MSN - sign up to our free newsletters!
http://www.msn.co.uk/newsletters
*
* 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/