I've this function to create a random range of numbers.
function randomRange(min, max) {
return (new Array(++max-min))
.join('.').split('.')
.map(function(v,i){ return min+i; })
.sort(function(){ return 0|Math.random()*max; });
}
It works perfect but only in Chrome. All other browsers have very little variation for some reason...
I've a simple demo here so you can see the difference http://jsfiddle.net/elclanrs/zZRda/.
As you can see the order of numbers in Chrome is mostly random but in other browsers there's not much variation, only a few numbers change place but it all looks almost the same.
Now check http://jsbin.com/iyalax/3/edit in Chrome and other browsers and you'll see the difference very clearly.
Any ideas why this is happening?
Edit: I've another randomRange
function that works fine in all browsers, it's just longer and uglier, check http://jsbin.com/iyalax/4/edit to see the difference.