> compareFunction(a, b) must always return the same value when given a specific pair of elements a and b as its two arguments. If inconsistent results are returned then the sort order is undefined.
It doesn't really matter what Math.random() is producing when the sort algorithm is undefined.
> compareFunction(a, b) must always return the same value when given a specific pair of elements a and b as its two arguments. If inconsistent results are returned then the sort order is undefined.
It doesn't really matter what Math.random() is producing when the sort algorithm is undefined.