Note on nomenclature: Opening hand is 7 cards. Draw one is 8 cards. Draw two is 9 cards. etc.
Note: this page is in very raw data form, meant for data analysis, not for presentation.
Update: Somehow I broke the math here, and something's wrong. I still think it's pretty close though. I'll fix it when I get time.
Odds of having at least 1 card(s) of 4 in deck of 60:(7) Opening hand: 38.8611% | Odds of having at least 2 card(s) of 4 in deck of 60:(7) Opening hand: 6.2937% | Odds of having at least 3 card(s) of 4 in deck of 60:(7) Opening hand: 0.0999% | Odds of having at least 4 card(s) of 4 in deck of 60:(7) Opening hand: 0.0000% |
License: You may use, modify, and redistribute this code, provided that you:
1) obtain my consent,
2) notify me of your improvements, and
3) give credit as such "[original] code by Tollie Williams."

odds of drawing a given card by Tollie Williams is licensed under a Creative Commons Attribution-No Derivative Works 3.0 United States License.
Permissions beyond the scope of this license is available by emailing me via http://www.tollie.org. It is possible that this code is considered common property. Personally, I hope not, considering how long it took me to tweak it, but it's really not that original either. If such is the case, then this code is defacto in the Public Domain; however, if it is and if you use it, it would be good of you to link back to my website anyways, since I saved you the time and effort of producing it yourself. :)
<table style="border-spacing: 5px;">
<tr>
<?php
$deck = $_REQUEST["deck"];
$cardsInit = $_REQUEST["cardsInit"];
$times = $_REQUEST["times"];
// init variables
if (empty($times)) {$times = 1000;}
if (empty($deck)) {$deck = 60;}
if (empty($cardsInit)) {$cardsInit = 4;}
$cards = $cardsInit;
// init arrays
for ($y=0; $y < $cardsInit; $y++) {
for ($z=0; $z < $deck; $z++) {
$allTime[$y][$z]=0;
}
}
for ($j=1; $j <= $times ; $j++) {
for ($y=0; $y < $cardsInit; $y++) { // go through countdown from cards to zero
$cardsLeft = $y + 1; // reset cardsLeft to hit target
$cards = $cardsInit; // reset number of cards left in deck
for ($i=$deck; $i > 0 ; $i--) { // count down from total deck size to 0.
// save cycles!
if ($cards == 0) {break;} // if done looking
if ($y > 16) {break;} // b/c they aren't relevant to the first 17 cards.
$pick = rand(1,$i); // pick random card from cards left
if ($pick <= $cards) { // if card is picked ==
$cardsLeft--; // cardsleft to hit target (typically 1,2,3,4)
if ($cardsLeft == 0) $allTime[$y][$deck-$i]++;
// nested array. allTime[# of cards we have][when drawn]
($cardsLeft == 0) ? $cards = 0 : $cards--;
// cards left in deck for next pick if still looking for more
}
}
}
}
for ($y=0; $y < $cardsInit; $y++) { // number of cards we have (at least)
$have = $y + 1;
// reset for each count
$d = 0; // drawCount variable
$openingHand = 0;
$plusOne = 0;
$plusTwo = 0;
$plusThree = 0;
$plusFour = 0;
$plusFive = 0;
$plusSix = 0;
$plusSeven = 0;
$plusEight = 0;
$plusNine = 0;
$plusTen = 0;
foreach ($allTime[$y] as $k) { // go through each array
$d++;
// add up "found card" values from allTime for hand-sizes
// ie. 1+2+3+4+5+6+7, then 1+2+3+4+5+6+7+8, then 1+2+3+4+5+6+7+8+9, etc.
if ($d<=7) { $openingHand = $openingHand + $k;}
if ($d<=8) { $plusOne = $plusOne + $k;}
if ($d<=9) { $plusTwo = $plusTwo + $k;}
if ($d<=10) { $plusThree = $plusThree + $k;}
if ($d<=11) { $plusFour = $plusFour + $k;}
if ($d<=12) { $plusFive = $plusFive + $k;}
if ($d<=13) { $plusSix = $plusSix + $k;}
if ($d<=14) { $plusSeven = $plusSeven + $k;}
if ($d<=15) { $plusEight = $plusEight + $k;}
if ($d<=16) { $plusNine = $plusNine + $k;}
if ($d<=17) { $plusTen = $plusTen + $k;}
}
// display results
echo "<td style=\"border: 1px solid black; padding: 10px;\"><h4>Odds of having at ";
echo "least " . $have . " card(s) of " . $cardsInit . " in deck of " . $deck . ":</h4>";
echo "<p>Opening hand: "; printf ("%01.4f", 100 * $openingHand / ($j)); echo "%<br />";
echo "Draw one: "; printf ("%01.4f", 100 * $plusOne / ($j)); echo "%<br />";
echo "Draw two: "; printf ("%01.4f", 100 * $plusTwo / ($j)); echo "%<br />";
echo "Draw three: "; printf ("%01.4f", 100 * $plusThree / ($j)); echo "%<br />";
echo "Draw four: "; printf ("%01.4f", 100 * $plusFour / ($j)); echo "%<br />";
echo "Draw five: "; printf ("%01.4f", 100 * $plusFive / ($j)); echo "%<br />";
echo "Draw six: "; printf ("%01.4f", 100 * $plusSix / ($j)); echo "%<br />";
echo "Draw seven: "; printf ("%01.4f", 100 * $plusSeven / ($j)); echo "%<br />";
echo "Draw eight: "; printf ("%01.4f", 100 * $plusEight / ($j)); echo "%<br />";
echo "Draw nine: "; printf ("%01.4f", 100 * $plusNine / ($j)); echo "%<br />";
echo "Draw ten: "; printf ("%01.4f", 100 * $plusTen / ($j)); echo "%</p></td>";
}
?>
</tr></table>