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

st: Re: RE: Creating a series of random number


From   "Ha Thai Son" <hathaison@hn.vnn.vn>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Re: RE: Creating a series of random number
Date   Tue, 25 May 2004 22:43:36 +0700

Thank you Nick,

That exactly what I want !

----- Original Message ----- 
From: "Nick Cox" <n.j.cox@durham.ac.uk>
To: <statalist@hsphsun2.harvard.edu>
Sent: Tuesday, May 25, 2004 9:20 PM
Subject: st: RE: Creating a series of random number


> I assume you want to sample from 
> a uniform distribution on some integers. 
> 
> Let's suppose we want to sample from 0 ... 9. 
> 
> gen random = floor(10 * uniform()) 
> 
> or from 00 (i.e. 0) ... 99 
> 
> gen random = floor(100 * uniform()) 
> 
> or from 10 ... 99 
> 
> gen random = 10 + floor(90 * uniform()) 
> 
> and so forth. 
> 
> This is wrapped in an -egen- function 
> -rndint()- in -egenmore- on SSC, 
> but doing it from first principles 
> is better exercise. 
> 
> Nick 
> n.j.cox@durham.ac.uk 
> 
> Ha Thai Son
> 
> > Does any one know how to create a series of random number 
> > with n digit.
> 
> *
> *   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index