Parameters
The odds of drawing a specific card is modeled using the hypergeometric distribution, and using it requires the following parameters:
-
Deck size: the number of cards in your deck you start the game with. Most games have a fixed deck size (e.g. Cardfight!! Vanguard, Magic: the Gathering’s EDH format, Flesh and Blood), but some allow you to play within a certain range (e.g. Yu-Gi-Oh, Magic’s Standard and Limited formats). Use whatever number you plan on starting the game with.
-
Hand size: the number of cards you draw before the game starts. These are the cards you see before you choose to mulligan, if the game has one.
-
Draws: the number of cards drawn after the mulligan. Because many games handicap the player going first by skipping their first draw step, this number will vary depending on if you go first or second. If different numbers are put for Draws (1st) and Draws (2nd), the calculator finds the probability distribution for both cases, then takes the average. (e.g. if the odds of drawing a card are 40% going first and 48% going second, the final odds will be 44%).
- If you just want to see the odds when you go first / second, let Draws (1st) and Draws (2nd) be the same number.
Here is a table of the numbers one would use to calculate the odds of drawing a card by turn 3 in some card games:
| TCG Name | Deck size | Hand size | Draws (1st) | Draws (2nd) |
|---|---|---|---|---|
| Cardfight! Vanguard | 50 | 5 | 4 | 6 |
| Magic: the Gathering (EDH) | 99 | 7 | 3 | 3 |
| Flesh and Blood 1 | 60 | 4 | 6 | 8 |
| Yu-Gi-Oh! | 40 | 5 | 2 | 3 |
| Grand Archive | 60 | 7 | 2 | 3 |
Desired range
Definition
A success is a card we’re interested in knowing the probability of drawing. Cards in the deck are segregated into either successes or failures.
In addition to the parameters above, you also need to specify how successes you want in your hand. This is done with the Minimum () and Maximum () parameters. Consider the following examples:
- and : the odds of drawing exactly one success
- and : the odds of drawing exactly one success or exactly two successes
- and : the odds of drawing exactly two, three, or four successes
The interval is the desired number of successes. Consider what the ideal amount you would want to draw is when choosing these numbers.
Statistics
Unlike most hypergeometric calculators, which require you to enter how many successes you already play, this calculator generates a table for every possible number of successes! You can compare and contrast different ratios at your leisure.
In that table you’ll find the following:
-
: the probability2 of drawing a desired number of successes. The highlighted row at the top of the table is the number of successes which maximizes this probability. If you want to draw a desirable amount as often much as possible, this is the recommended amount to play.
-
Mean: the expected number of successes you will draw over multiple games. This is calculated using the normal, arithmetic mean:
Often, the number which maximizes the odds of drawing successes will be at or right below the amount where the mean is greater than .
-
: the probability of drawing at least one success. This is the same as , or the complement of the probability of no successes in hand. If you’re interested in a card type for which “too many” isn’t an option, reference this number and use your best judgement.
-
Mode: the number of successes you will draw the most often. The mode is the amount which will appear the most frequently in your games (given the parameters chosen). If you don’t care about maximizing your chance at drawing a card, and just want it to happen more often than not, consider using the mode.
Example
In Yu-Gi-Oh, you build a 40-card deck, play with a five-card starting hand, and only draw one card going second. Say we wanted to find the probability of drawing exactly one copy of a card by turn 1. The parameters and corresponding outputs should look like this:
Draws (1st)0Draws (2nd)1
Minimum ()1Maximum ()1
Undesired cards0
| # | Mean | Pr( 1) | Mode | |
|---|---|---|---|---|
| 5 | 41.037% | 0.688 | 54.188% | 0 |
| 6 | 42.892% | 0.825 | 61.337% | 1 |
| 7 | 43.407% | 0.963 | 67.538% | 1 |
| 8 | 42.845% | 1.100 | 72.894% | 1 |
| 9 | 41.438% | 1.238 | 77.498% | 1 |
Here’s how to read it:
- Running 7 copies in the deck maximizes the chance at drawing exactly one success.
- For the average number of success to be greater than one, you would need to run 8 copies instead of 7.
- If you ran 7, you would see at least one success in about 67.5% of your games. Conversely, you would miss drawing any successes in 32.5% or about one-third of your games.
- Running 5 copies has a mode of 0, which means not drawing the card happens more often than drawing one. However, going from 5 to 6 copies puts the mode to 1, where drawing one copy is the most likely outcome. This is the case whether you run 6, 7, or 8 copies.
The Cardfight!! Vanguard Mulligan
Cardfight!! Vanguard has a unique mulligan: you start the game by drawing five cards, then you may choose any number of cards in that hand to put onto the bottom of the deck and draw the same amount. The fact the deck is shuffled after the mulligan, along with one-third of a deck is composed of triggers, adds an extra level of complexity to the odds of drawing a card.
Definition
An undesired card is any card in the deck which one would return in the mulligan. Triggers are usually undesired card, but any card which one would not want to keep is considered undesired.
The calculator assumes three distinct card types:
- Successes, which are kept in hand during the mulligan.
- Undesired cards, which are put back for the mulligan.
- Non-successes, which are kept in hand but aren’t the focus of the calculations.
For any game which does not have the same mulligan as Vanguard, set Undesired cards to 0. This forces the calculator to function as if there were no mulligan at all, as there would only be two card types in the deck: successes and non-successes.
Example
Rancor Chain is one of the few ride deck cards which can be played in any «Stoicheia» deck. While it doesn’t require a specific ride line, it does ask the player to dedicate some deck space for orders. We should run enough orders so that Rancor Chain “always” has an order to discard; but too many orders will leave our early-game hand lacking in shield and board presence.
Draws (1st)3Draws (2nd)4
Minimum 1-2Maximum 1-2
Undesired cards16
| # | Mode | |||
|---|---|---|---|---|
| 4 | 43.227% | 58.453% | 15.226% | 1 |
| *5 | *43.498% | 64.570% | 21.072% | 1 |
| 6 | 41.755% | 67.863% | 26.108% | 1 |
| *7 | 38.707% | *68.728% | 30.022% | 1 |
| 8 | 34.898% | 67.581% | 32.683% | 1 |
| 9 | 30.738% | 64.829% | 34.092% | 2 |
| *10 | 26.522% | 60.862% | *34.340% | 2 |
| 11 | 22.458% | 56.036% | 33.578% | 2 |
Assuming we put any triggers we see back to deck, we draw 3 cards going first (1 per turn, 2 from Rancor Chain itself), and draw 4 cards going second, we get these probabilities. Going column by column:
- The odds of drawing exactly one order by the time you have to discard is maximized at 5 orders.
- The odds of drawing either one or two orders is maximized at 7 orders.
- The odds of drawing exactly two orders is maximized at 10 orders.
- You will draw one order most often if you run between 4 and 8 orders, while you’ll see two more often running 9 orders and up.
10 orders seems like the most one would want to run to make use of Rancor Chain. 7 is probably a good lower limit, since that maximizes drawing either one or two orders which are both good outcomes.
Let’s also look at how likely it is to draw at least one order, or , both with and without the mulligan:
| # | Pr. with mulligan | Pr. w/o mulligan |
|---|---|---|
| 1 | 20.011% | 17.000% |
| 2 | 36.396% | 31.388% |
| 3 | 49.741% | 43.520% |
| 4 | 60.547% | 53.713% |
| 5 | 69.247% | 62.241% |
| 6 | 76.206% | 69.346% |
| 7 | 81.736% | 75.241% |
| 8 | 86.098% | 80.109% |
With 16 triggers to put back, there’s a roughly 3-7% increase in the odds of drawing an order with the mulligan than without; that gap is the widest at 5 orders with a difference of 7.006%. Pretty substantial! Now we know the exact effect that Vanguard’s generous mulligan has on consistency.
How does it work?
There are two factors which muddy the calculations:
- How many cards are drawn for the mulligan is determined by how many undesired cards are drawn pre-mulligan.
- Undesired cards are shuffled back into the deck post-mulligan.
Think of how you would calculate the odds of drawing exactly one success by turn 2. The probability is 0 if you already have one or more successes in hand; if you don’t, it depends entirely on your draws on turn 1 and turn 2. If we wanted to know the odds of drawing exactly two successes, we would have three cases: where we drew no successes, where we drew one success, and where we drew two.
Rather than use one hypergeometric distribution, we consider three. is the number of successes drawn pre-mulligan; is the number of successes post-mulligan; and is the number of successes after in-game draws. is the variable we are interested in, but it is dependent on and is dependent on . Using conditional probabilities, we can write the full expression like this:
where
is the number of undesired cards drawn, is the number of undesired cards in deck, and is the number of post-mulligan draws.
This is a pretty messy expression, but easy to automate. The calculator uses a simple for loop to find the “prior” distribution.
Assuming 10 of the desired card are played:
const priors = [];
for(var k_post = 0; k_post <= 5; k_post++){
for(var trigger = 0; trigger <= 5; trigger++) {
for(var k_pre = 0; k_pre <= k_post; k_pre++) {
const p_prior = multigeodist(
k_pre, 10,
trigger, 16,
5, 50
);
const p_post = hypgeodist(
k_post - k_pre, 10 - k_pre,
trigger, 45
);
priors.push(p_prior * p_post);
}
}
}
With this prior distribution as a base, we can calculate the odds of drawing successes after the mulligan pretty easily.