Perl Card Calculator:


© 1999 by Scott David Gray.


There is a 17.9579093432007% chance of drawing at least one target card, for a deck size input as 48, a number of target cards input as 3, and a number of cards to be drawn input as 3.


One can calculate the probability of drawing at least ONE of a set of target cards from a deck by using the following formula, in which D=deck size, T=number of target cards and H=number of cards to be drawn into the hand:
probability=1-((((D-T)!)-((D-T-H))!))/((D!)-((D-H)!)-1))


The form below allows you to submit numbers to the card calculator program. The numbers will be crunched on another machine, and you will be told the probability of drawing one or more specific target cards from a random deck of any size with any number of draws.

When you tell the program how many cards are in the deck, count all unidentified cards in people's hands, and discount all cards that you know the identity of.

Likewise, when you tell the program how many target cards are in the deck, discount all target cards that you know the identity of.

EX: Henry and John are playing cards. They each have a hand of four cards, from a normal 52 card deck. John has an ace, a ten, and 2 fours. John doesn't know what Henry has. If John draws three more cards, and he wants to draw at least one more ace, to calculate his chances with this program he would answer:

    48 cards in the deck (52 card deck, minus the cards in John's hand).
    3 target cards (4 aces in the deck, minus the one John knows about).
    3 cards to be drawn.

You must make at least one draw, and have at least one target card. The deck must have at least as many cards as will be drawn. The deck must have at least as many cards as there are target cards.

All numbers must be input as positive integers. Neither the size of the hand, nor the number of target cards, can exceed the size of the deck.


Data:

Total number of cards in deck:
Number of target cards in deck:
Number of cards to be drawn:


This program was designed (and the math calculated) by Scott David Gray, from the Sudbury Valley School.
If you find this program to be useful, you will want to check out my PERL General Dice Pool Calculator program, and PERL Shadowrun Dice Pool Calculator program.

Click here for copy of this program.


If you find this program useful, please treat me to to a $3 cup of coffee!!!