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]

Re: st: looking for more efficient programming for randomly shuffling list of numbers


From   Scott Merryman <scott.merryman@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: looking for more efficient programming for randomly shuffling list of numbers
Date   Thu, 26 Aug 2010 11:05:37 -0500

So you want 9600 random variables uniformly distributed [1, 20]?

You could use mata:

mata: u = trunc(runiform(20,9600):*20 :+1)
getmata (u*)=u,replace

Scott

On Thu, Aug 26, 2010 at 10:11 AM, Evelyn Ersanilli
<evelyn.ersanilli@qeh.ox.ac.uk> wrote:
> Dear Statalisters,
>
> For a survey I need to make stickers that can be used to randomly select respondents within a household.
> These stickers should contain the numbers 1-20 in a random order (most households will have less than 20 members). Each sticker should have its own random order, though it is not a problem if by chance some stickers are the same. The stickers should be generated in such a way that each order of numbers 1-20 should be possible and equally likely.
>

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