3 ms·
The random return used in the comparison passed into an Array.sort() function would depend on the sort algorithm used by the JavaScript engine, since the compar
by spdustin 10y ago
The random return used in the comparison passed into an Array.sort() function would depend on the sort algorithm used by the JavaScript engine, since the comparisons being returned aren't "honest". Is it a merge sort, for example? Plus, it's kinda broken because if X > Y for one permutation, it should follow that Y < X if those same values are passed back in, and in this case, they' really not.
MS took advantage of this when selecting a random browser for the browser ballot years ago.
http://www.robweir.com/blog/2010/02/microsoft-random-browser-ballot.html http://www.robweir.com/blog/2010/02/microsoft-random-browser...