To expand on what thraxil has said...
This probability and permutations exercise could be written as:
#!/usr/bin/perl -w use strict; my $DAYS_IN_YEAR = 365; print "\n# of People \t Birthday Match Likelihood\n" . '-'x80 . "\n"; for my $people ( 2 .. 40 ){ my $tmp_days = $DAYS_IN_YEAR; my $probability=1; for ( 1 .. $people ){ $probability *= $tmp_days--; } $probability /= $DAYS_IN_YEAR ** $people; $probability = ( 1 - $probability ) * 100; print "$people \t\t $probability %\n"; } exit;
In reply to Re: Re: Re: Birthday Chances
by ckohl1
in thread Birthday Chances
by YuckFoo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |