Re:JavaScript Things I Wish I Knew Much Earlier In My Career
by _delirium on Tuesday April 20, 2010 @07:11PM
(#1280871)
The article itself is quite useful, but a warning on the sort tutorial he links to (http://www.javascriptkit.com/javatutors/arraysort.shtml). Contrary to what it says, you cannot reliably shuffle a list by doing:
This just makes every comparison return a random value, which may or may not produce particularly random results, depending on the sort algorithm. It's exactly the bug that bit Microsoft in their not-very-random browser shuffle screen.
[ Parent
| on HN ]
There are no comments on this comment yet.