Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Computing > NZ Computing > How Not To Shuffle Things Into Random Order

Reply
Thread Tools

How Not To Shuffle Things Into Random Order

 
 
Lawrence D'Oliveiro
Guest
Posts: n/a
 
      03-10-2010
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>
 
Reply With Quote
 
 
 
 
Gordon
Guest
Posts: n/a
 
      03-11-2010
On 2010-03-11, geoff <(E-Mail Removed)> 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/...er-ballot.html

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

Indeed, we replied to this post eh geoff?
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Array.shuffle/Array.shuffle! Jeff Moore Ruby 6 10-09-2008 07:14 PM
random.random(), random not defined!? globalrev Python 4 04-20-2008 08:12 AM
Re: Implementaion of random.shuffle Steve Holden Python 15 07-19-2007 12:05 PM
Shuffle array elements (3 to end of array) in random order Tuxedo Javascript 8 05-07-2007 03:28 PM



Advertisments