coffeescript-cookbook/coffeescript-cookbook.github.com — pull request #72 by d8uv (2013-02-28 20:04:04+00:00)
Title: Change the shuffle to the Fisher-Yates shuffle

The current "Shuffling Array Elements" page recommends a naive algorithm, which produces a slow and biased shuffle. Included is a highly idiomatic refactorization of the Fisher-Yates shuffle (aka the Knuth Shuffle), a less-idiomatic-but-better refactorization, and aversion of the algorithm that adds to Array.prototype, for those that program in that style.