Originally Posted by Old Pedant
Ummm...Philip misspoke. Or perhaps his meaning simply wasn't clear (at least to me). That *does* shuffle the arrays, but it shuffles AND REPLACES the given array.
That is, for example, when you do
var d = b.shuffle() you end up shuffling b *IN PLACE* and then assigning that shuffled version to d, resulting in two arrays with the same content. (Or, more correctly, two variables referencing the same array object.)
And because of the use of this.splice(), you lose the original array.
Julien's solution fixes that (or changes that, if it was intended behavior).
For the life of me I do not see the use of "two arrays with the same content. (Or, more correctly, two variables referencing the same array object.)".
How can it make sense to lose/replace the original array? That was the point I was trying to make.