[racket-dev] How about adding this simple list-shuffling procedure to racket?

From: Carl Eastlund (cce at ccs.neu.edu)
Date: Thu Nov 11 12:40:34 EST 2010

On Thu, Nov 11, 2010 at 12:40 PM, Neil Toronto <neil.toronto at gmail.com> wrote:
>
> I don't know. I know that the "run through the list and swap with another
> random element" algorithms are usually non-uniform, and so are a lot of
> other things that seem like they'd work. I wouldn't use something that
> wasn't proven to shuffle uniformly, at least for any serious statistics
> work.

But this is not "run through the list and swap with another random
element".  It's "pick a random, uniform ordering, and then sort based
on it".  The random keys are chosen per element and cached (hence
#:cache-keys? #t), not per comparison.

--Carl


Posted on the dev mailing list.