# How Not To Shuffle Things Into Random Order

Discussion in 'NZ Computing' started by Lawrence D'Oliveiro, Mar 10, 2010.

1. ### Lawrence D'OliveiroGuest

Hard to believe Microsoft could do something as stupid as this:

function GenerateBrowserOrder()
{
var aBrowserOrderTop5 = new Array(0,1,2,3,4);
var aBrowserOrderRest = new Array();
for (var i=5; i < dataBrowsers.length; i++)
{
aBrowserOrderRest.push(i);
}
aBrowserOrderTop5.sort(RandomSort);
aBrowserOrderRest.sort(RandomSort);
aBrowserOrder = aBrowserOrderTop5.concat(aBrowserOrderRest);
}

function RandomSort (a,b)
{
return (0.5 - Math.random());
}

<http://www.robweir.com/blog/2010/02/microsoft-random-browser-ballot.html>

Lawrence D'Oliveiro, Mar 10, 2010

2. ### GordonGuest

On 2010-03-11, geoff <> wrote:
> Lawrence D'Oliveiro wrote:
>> Hard to believe Microsoft could do something as stupid as this:
>>
>> function GenerateBrowserOrder()
>> {
>> var aBrowserOrderTop5 = new Array(0,1,2,3,4);
>> var aBrowserOrderRest = new Array();
>> for (var i=5; i < dataBrowsers.length; i++)
>> {
>> aBrowserOrderRest.push(i);
>> }
>> aBrowserOrderTop5.sort(RandomSort);
>> aBrowserOrderRest.sort(RandomSort);
>> aBrowserOrder = aBrowserOrderTop5.concat(aBrowserOrderRest);
>> }
>>
>> function RandomSort (a,b)
>> {
>> return (0.5 - Math.random());
>> }
>>
>> http://www.robweir.com/blog/2010/02/microsoft-random-browser-ballot.html

>
> Some people must have really empty lives ....
>
>

Indeed, we replied to this post eh geoff?

Gordon, Mar 11, 2010