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

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Fri Nov 12 15:36:46 EST 2010

I think we should put in a list shuffler into the core.

Which should we use? The faster one?

Jay

On Thu, Nov 11, 2010 at 11:26 AM, Eli Barzilay <eli at barzilay.org> wrote:
> 5 minutes ago, Neil Toronto wrote:
>> Carl Eastlund wrote:
>> > 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.
>>
>> Spanking good point, my good man. I think you're right.
>
> It's a very common method, and the classic example of the
> decorate-map-strip method that has some perl-guy's name slapped on it
> now.
>
> The wikipedia page on FY is pretty decent -- and one concern that I've
> encountered in the past is that it's sensitive to what that page calls
> "modulo bias".  The decorated version is more robust, especially with
> (random) that works at the highest `random' granularity.
>
> (BTW, to compare them you should use some (random 1000) thing to avoid
> the fp cost.)
>
> --
>          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
>                    http://barzilay.org/                   Maze is Life!
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/dev
>



-- 
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://faculty.cs.byu.edu/~jay

"The glory of God is Intelligence" - D&C 93


Posted on the dev mailing list.