Thank you all. Problem solved.
On 1/23/07, Nick Cox <[email protected]> wrote:
Assuming at least 51 observations:
gen integers = _n + 50
gen random = uniform()
sort random
Now select as many of the first 51
values of -integers- as you wish.
They are distinct by construction
and their randomness is imparted
by shuffling.
For reproducibility -set seed-
in advance and record it.
Nick
[email protected]
Raphael Fraser
> How do I generate random numbers between say, 50-100 that do not
> repeat themselves? I have used the following code but this allow the
> numbers to repeat themselves:
>
> gen bsid=50*int(50*uniform()+0.5)
*
* 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/