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 on April 23, 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   Sergiy Radyakin <serjradyakin@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 12:10:08 -0400

Scott,

I guess they must also by unique within each household. if runiform()
gives 100 or 101, trunc()
will round it to the same value, and that will be no good, since two
persons will end up with the
same stickers.

Best, S.R.



On Thu, Aug 26, 2010 at 12:05 PM, Scott Merryman
<scott.merryman@gmail.com> wrote:
> 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/
>

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