## Friday, November 14, 2008

### Picking winners

I just came across a post at fontblog where it is described how they picked a winner from 36 contributors: They take a dice and throw it once. The number shown is the number of further throws of the dice that are added up to yield the winning number. Obviously, any number 1..36 can be picked, but the distribution is not even: Contributor 1 is picked if the first throw yields a one and the second one as well: probability 1/36. Contributor 2 will be picked by two sequences: 1 2 and 2 1 1 giving 1/6 x 1/6 + 1/6 x 1/6^2 and so on. Conributor 36 is only picked when 7 sixes are thrown in a row, i.e. with probability 1/6^7.

Of course I could not resist and write a perl program to compute the probability distribution, here it is: Somewhat surprisingly, contributor 29 was eventually picked although he only had a probability of 0.28% a tenth of the average 1/36.

And here is the program:
#!/usr/bin/perl%h = (0 => 1);for $t(1..6){ %h = nocheinwurf(%h); print "$t:\n";    foreach $s(sort {$a <=> $b} keys %h){ print "$s:".$h{$s}/6**$t." ";$total[$s] +=$h{$s}/6**($t+1);    }    print "\n\n";}print "total:\n";foreach $s(1..36){ print "$s $total[$s]\n";}sub nocheinwurf{    my %bisher = @_;        my %dann;    for $w(1..6){ foreach$s(keys %bisher){            $dann{$s+$w} +=$bisher{\$s};        }    }    return(%dann);}

#### 1 comment:

Igor said...

It is funny, the distribution resembles the placzek function in neutron transport theory. The function represents the sum of the convoluted iterates of the box spline function.

Igor.
http://nuit-blanche.blogspot.com