Re: Help: Randomizing a List of Numbers
From: John Savard (jsavard_at_excxn.aNOSPAMb.cdn.invalid)
Date: Tue, 20 Jul 2004 12:36:28 GMT
On Tue, 20 Jul 2004 10:07:46 GMT, Tom St Denis <firstname.lastname@example.org>
wrote, in part:
>Your other post about doing the "swaps" is exactly what I was talking
>against. It's not provably going to get you a uniformly distributed
As long as you don't make the mistake of doing the swap between the
item in the list that you're trying to fill permanently, and one of
the locations *already* filled, of course the algorithm I exhibited
provides a uniformly distributed permutation from the space of 10,000!
possibilities. The side effect of shifting around the unallocated
items so as to avoid moving them a lot does not change the fact that
each one still has an equal opportunity of being selected.
The "swap" is *precisely* the optimization required.