in reply to Re: Messing Around
in thread Messing Around

No, it's a command-line one-liner.... perl -e 'srand;push(@c,0)foreach(0..53);foreach(1..1e4){@d=(); foreach(0..53){$e{$_}=1;}foreach(0..5){$i=int(rand(54));while (!$e{$i}){$i=int(rand(54));} push(@d,$i);$e{$i}=0;} foreach(@d){$c[$_]++}}foreach(sort{$c[$b]<=>$c[$a]}0..$#c) {print $_+1," ",$c[$_],", ";}'

It also prevents duplicates per drawing. Explaining how it works and where they got it is left as an exercise to the student (as this smells a bit like homework)....

Update 22 Feb 2005: Fixed small typos, added a few spaces into code.

Update 22 Feb 2005: The code above appears to run in just under 1.0s, according to time(1), and weighs in around 267c total (256c for the code).