Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Re: Re: Birthday Chances

by ckohl1 (Hermit)
on Feb 15, 2002 at 17:56 UTC ( [id://145781]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re: Re: Birthday Chances
in thread Birthday Chances

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;


Chris

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://145781]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.