coffeescript-cookbook/coffeescript-cookbook.github.com — pull request #126 by malgorithms (2014-12-05 16:30:45+00:00)
Title: fixed broken shuffle for arrays of length 1 or 0

Coffeescript's range evaluator (in this case [a.length-1..1]) produces inappropriate results for Fisher-Yates when the array is length 1 or 0. The unfixed shuffle pushes undefined values onto the the array. A length check is necessary to continue with this style.