Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: RE: Random numbers


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: Random numbers
Date   Wed, 12 May 2010 19:03:24 +0200

<>

If you want non-integers:


***********
clear*
set obs 10000
//To generate random variates over the interval [a,b)
local a 100
local b 1000
gen myrandomnumber=`a'+(`b'-`a')*runiform()
***********


HTH
Martin


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Martin Weiss
Sent: Mittwoch, 12. Mai 2010 18:59
To: statalist@hsphsun2.harvard.edu
Subject: st: RE: Random numbers


<>

See -h runiform()-:

***********
clear*
set obs 10000

//To generate random integers over [a,b]
local a 100
local b 1000
gen myrandomnumber=`a'+int((`b'-`a'+1)*runiform())
***********


HTH
Martin

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Evans Jadotte
Sent: Mittwoch, 12. Mai 2010 18:53
To: statalist@hsphsun2.harvard.edu
Subject: st: Random numbers

Hello statlisters,

I would like to generate a distribution of 1000 observations randomly 
distributed  between 100 and 1000. Any help with the command is much 
appreciated.

Thanks,
Evans
*
*   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/

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

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index