An inefficient approach to randomization (August 10, 2005)

This page is moving to a new website.

Someone figured out how to prepare a randomization table on their own and it works reasonably well, but still has a few problems. She used the randbetween(1,2) function to randomly select either 1 or 2 with 50% probability. That works nicely up to a point, but at the end of the 400 rows, the total number of 1's was 223 and the total number of 2's was 177. When you flip a coin 400 times, the distribution of heads and tails is random, but there is no guarantee that the number of heads will be exactly 200. The same problem applies to the randbetween() function.

If you can live with a final disparity of sample sizes, then this approach works fine. It is better though, to create a list in a systematic order (1, 2, 1, 2, 1, 2, ...) and then attach a column of random numbers (=rand()). sort both columns by the column of random numbers and that effectively puts the first column in a random order.