# Yet another odds question (simulating two dice rolls with a deck of cards)

**URL:** <https://boards.straightdope.com/t/yet-another-odds-question-simulating-two-dice-rolls-with-a-deck-of-cards/972087>\
**Category:** Factual Questions\
**Created:** [September 23, 2022, 3:32pm UTC](https://boards.straightdope.com/t/yet-another-odds-question-simulating-two-dice-rolls-with-a-deck-of-cards/972087 "2022-09-23T15:32:57Z")\
**Posts on this page:** 20\
**Page:** 3

<div class="post-metadata">

**Author:** ![Thudlow\_Boink](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/thudlow_boink/32/320_2.png) [@Thudlow\_Boink](https://boards.straightdope.com/u/Thudlow_Boink)\
**Post date:** [September 23, 2022, 5:55pm UTC](https://boards.straightdope.com/t/yet-another-odds-question-simulating-two-dice-rolls-with-a-deck-of-cards/972087/41 "2022-09-23T17:55:21Z")

</div>

> [@iamthewalrus\_3](#):
>
> That is the infinite sum that @Great_Antibob calculated.

Yes, you’re right—formulated slightly differently, but equivalent.

---

<div class="post-metadata">

**Author:** ![Thudlow\_Boink](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/thudlow_boink/32/320_2.png) [@Thudlow\_Boink](https://boards.straightdope.com/u/Thudlow_Boink)\
**Post date:** [September 23, 2022, 6:20pm UTC](https://boards.straightdope.com/t/yet-another-odds-question-simulating-two-dice-rolls-with-a-deck-of-cards/972087/42 "2022-09-23T18:20:23Z")

</div>

> [@Thudlow\_Boink](#):
>
> It looks to me like the expected number of shuffles is  
> (1)(\frac{20}{21}) + (2)(\frac{1}{21})(\frac{20}{21}) + (3)(\frac{1}{21})^2(\frac{20}{21}) + (4)(\frac{1}{21})^3(\frac{20}{21}) + ...
> 
> There may be a clever way to get an exact value of this series, but I just calculated the first 15 or so terms and got 1.05.

In case anyone is interested, I found that “clever way to get an exact value”:

First, factor out the common factor of \frac{20}{21} to get (\frac{20}{21}) \sum\_{n=1}^{\infty} n(\frac{1}{21})^{n-1}.  
To evaluate this infinite sum, note that the geometric series \sum\_{n=0}^{\infty}x^n has sum \frac{1}{1-x} when |x| \< 1.  
If f(x) = \sum\_{n=0}^{\infty}x^n = \frac{1}{1-x} then f'(x) = \sum\_{n=0\text{ or }1}^{\infty}nx^{n-1} = \frac{1}{(1-x)^2}.  
When x = \frac{1}{21} this evaluates to \frac{1}{(1-(\frac{1}{21}))^2} = \frac{1}{(\frac{20}{21})^2}.  
So (\frac{20}{21}) \sum\_{n=1}^{\infty} n(\frac{1}{21})^{n-1} = (\frac{20}{21})\frac{1}{(\frac{20}{21})^2} = \frac{1}{(\frac{20}{21})} = \frac{21}{20} = 1.05.

---

<div class="post-metadata">

**Author:** ![iamthewalrus\_3](https://avatars.discourse-cdn.com/v4/letter/i/258eb7/32.png) [@iamthewalrus\_3](https://boards.straightdope.com/u/iamthewalrus_3)\
**Post date:** [September 23, 2022, 6:38pm UTC](https://boards.straightdope.com/t/yet-another-odds-question-simulating-two-dice-rolls-with-a-deck-of-cards/972087/43 "2022-09-23T18:38:40Z")

</div>

ETA: I realized my new idea was already rejected in the OP.

---

<div class="post-metadata">

**Author:** ![Andy\_L](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@Andy\_L](https://boards.straightdope.com/u/Andy_L)\
**Post date:** [September 23, 2022, 7:57pm UTC](https://boards.straightdope.com/t/yet-another-odds-question-simulating-two-dice-rolls-with-a-deck-of-cards/972087/44 "2022-09-23T19:57:27Z")

</div>

“Yes, yes, it’s all a rich tapestry”

[![](https://img.youtube.com/vi/qfKW5oYViM0/hqdefault.jpg "The Simpsons - Yes Yes, it's all a rich tapestry") ](https://www.youtube.com/watch?v=qfKW5oYViM0)

---

<div class="post-metadata">

**Author:** ![Chronos](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/chronos/32/134_2.png) [@Chronos](https://boards.straightdope.com/u/Chronos)\
**Post date:** [September 23, 2022, 8:56pm UTC](https://boards.straightdope.com/t/yet-another-odds-question-simulating-two-dice-rolls-with-a-deck-of-cards/972087/45 "2022-09-23T20:56:39Z")

</div>

> [@Dr.Winston\_OBoogie](#):
>
> How about this: Take a standard deck of cards; remove all face cards. Shuffle. Pick a card. Pick another card. If it’s the same color, pick a third; if it’s the same color, pick a 4th; etc. Bottom line, you get one black card to represent the first die and a red card to represent the second die. Hearts and Spades represent 1 - 10; Diamonds and Clubs represent 11-20. One shuffle; multiple draws; simulates 2d20.

I think this works: It’s equivalent to having a Red Deck and a Black Deck, shuffling both, and then taking the top card of each. The only difference is that you merge the two decks so you can shuffle them both at the same time.

Note, of course, that though this meets the OP’s stated criteria, it is nonetheless less efficient than the multiple-shuffling solutions, because thoroughly shuffling a deck of 40 cards is more work than thoroughly shuffling two decks of 20 cards each.

---

<div class="post-metadata">

**Author:** ![Thudlow\_Boink](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/thudlow_boink/32/320_2.png) [@Thudlow\_Boink](https://boards.straightdope.com/u/Thudlow_Boink)\
**Post date:** [September 23, 2022, 9:14pm UTC](https://boards.straightdope.com/t/yet-another-odds-question-simulating-two-dice-rolls-with-a-deck-of-cards/972087/46 "2022-09-23T21:14:13Z")

</div>

> [@Chronos](#):
>
> thoroughly shuffling a deck of 40 cards is more work than thoroughly shuffling two decks of 20 cards each.

Can you explain why, or provide a cite?

---

<div class="post-metadata">

**Author:** ![Chronos](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/chronos/32/134_2.png) [@Chronos](https://boards.straightdope.com/u/Chronos)\
**Post date:** [September 23, 2022, 9:17pm UTC](https://boards.straightdope.com/t/yet-another-odds-question-simulating-two-dice-rolls-with-a-deck-of-cards/972087/47 "2022-09-23T21:17:34Z")

</div>

Basically, because a shuffled deck of 40 cards contains more information than two decks of 20 cards each. If I tell you what order the red cards are in relative to other red cards, and what order the black cards are in relative to other black cards, I still haven’t told you what the sequence of reds and blacks is. By shuffling the full 40 card deck, you need to randomize that last part, too, even though the problem doesn’t require it.

---

<div class="post-metadata">

**Author:** ![Thudlow\_Boink](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/thudlow_boink/32/320_2.png) [@Thudlow\_Boink](https://boards.straightdope.com/u/Thudlow_Boink)\
**Post date:** [September 23, 2022, 10:02pm UTC](https://boards.straightdope.com/t/yet-another-odds-question-simulating-two-dice-rolls-with-a-deck-of-cards/972087/48 "2022-09-23T22:02:28Z")

</div>

> [@Chronos](#):
>
> Basically, because a shuffled deck of 40 cards contains more information than two decks of 20 cards each.

Okay, I see that, but what isn’t clear to me is how/whether the amount of information contained translates to the amount of work required.

Part of the problem is that “work” in this context isn’t well-defined. But what if we look at the number of shuffles required? It’s widely reported that 7 shuffles are required to thoroughly randomize a standard deck of 52 cards. I was able to find numerous cites of this, with explanations of why and caveats about the method of shuffling used. But I was less successful in finding the number of shuffles required for decks of other sizes. If 7 shuffles are required for a 52-card deck, how many shuffles are required for a 20-card deck and a 40-card deck?

I did find [this cite](https://blogs.mathworks.com/cleve/2016/02/15/how-many-times-should-you-shuffle-the-cards-2/#c23ac93b-8dc0-4b9d-98fd-b0238f3fe9a8) that claims that “about ten riffle shuffles are usually necessary and sufficient to completely shuffle four decks” (208 cards). It looks to me like that means that it is _more_ work to shuffle two separate decks of 52 cards than to shuffle one deck of 208 cards, let alone one deck of 104 cards. This would lead me to suspect that it takes more work to shuffle two decks of 20 cards than to shuffle one deck of 40 cards.

---

<div class="post-metadata">

**Author:** ![SunUp](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@SunUp](https://boards.straightdope.com/u/SunUp)\
**Post date:** [September 23, 2022, 10:05pm UTC](https://boards.straightdope.com/t/yet-another-odds-question-simulating-two-dice-rolls-with-a-deck-of-cards/972087/49 "2022-09-23T22:05:25Z")

</div>

> [@Johnny\_Bravo](#):
>
> I want to simulate rolling two twenty-sided dice. I should have said any “particular” duplicate value, not “any duplicate value.”

Can I ask one clarifying question - because it’s not completely clear to me exactly what you’re trying to find.

Do you want:

- a draw deck equivalent of two independent, ordered d20 rolls, where (for example) 7 followed by 12 is different from 12 followed by 7; or
- a draw deck equivalent of the sum of two independent d20 rolls (i.e. 2d20 in AD&D lingo)

I think the procedure you outlined in your first post will get you the second, but not the first.

---

<div class="post-metadata">

**Author:** ![iamthewalrus\_3](https://avatars.discourse-cdn.com/v4/letter/i/258eb7/32.png) [@iamthewalrus\_3](https://boards.straightdope.com/u/iamthewalrus_3)\
**Post date:** [September 23, 2022, 10:08pm UTC](https://boards.straightdope.com/t/yet-another-odds-question-simulating-two-dice-rolls-with-a-deck-of-cards/972087/50 "2022-09-23T22:08:17Z")

</div>

Ok, thinking about this in another way: Is there an N and K such that N choose K is a multiple of 400 (or close to it) and N and K are relatively small?

If so, then is there a way to map the 400 choices onto the set of K cards in a way that doesn’t require some arcane lookup method to turn it into two numbers in [1,20]?

14 choose 5 is 2002, which gives you 5 encodings for each of the 400 possible dice rolls we want to encode, with only two NULLs.

So, make your deck of 14 cards, draw 5 of them, convert to your die roll, and you’re good. You’ll have to reshuffle 1 in every 1000 times, but you also only have to shuffle 14 cards, so think how many fewer cards you’ll have to shuffle!

The process of mapping 5 cards into 400 outputs is left as an exercise to the reader. So far I’ve thought of some dumb ways to do it, but there may be a clever way I’ve not yet thought of.

---

<div class="post-metadata">

**Author:** ![Little\_Nemo](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/little_nemo/32/3120_2.png) [@Little\_Nemo](https://boards.straightdope.com/u/Little_Nemo)\
**Post date:** [September 23, 2022, 10:11pm UTC](https://boards.straightdope.com/t/yet-another-odds-question-simulating-two-dice-rolls-with-a-deck-of-cards/972087/51 "2022-09-23T22:11:06Z")

</div>

Have a twenty-one card deck; one through twenty plus a “duplicate” card.

Draw your first card and put it aside. Draw your second card.

If either of your cards is the duplicate then treat it as a copy of the other card you drew, which must be a number.

---

<div class="post-metadata">

**Author:** ![iamthewalrus\_3](https://avatars.discourse-cdn.com/v4/letter/i/258eb7/32.png) [@iamthewalrus\_3](https://boards.straightdope.com/u/iamthewalrus_3)\
**Post date:** [September 23, 2022, 10:18pm UTC](https://boards.straightdope.com/t/yet-another-odds-question-simulating-two-dice-rolls-with-a-deck-of-cards/972087/52 "2022-09-23T22:18:10Z")

</div>

ETA: removed snark. Apologies.

That has been suggested and rejected above.

---

<div class="post-metadata">

**Author:** ![Dr.Strangelove](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/dr.strangelove/32/6613_2.png) [@Dr.Strangelove](https://boards.straightdope.com/u/Dr.Strangelove)\
**Post date:** [September 23, 2022, 10:22pm UTC](https://boards.straightdope.com/t/yet-another-odds-question-simulating-two-dice-rolls-with-a-deck-of-cards/972087/53 "2022-09-23T22:22:44Z")

</div>

> [@Little\_Nemo](#):
>
> If either of your cards is the duplicate then treat it as a copy of the other card you drew, which must be a number

Odds of snake eyes is 2/420, not 1/400.

---

<div class="post-metadata">

**Author:** ![Johnny\_Bravo](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/johnny_bravo/32/493_2.png) [@Johnny\_Bravo](https://boards.straightdope.com/u/Johnny_Bravo)\
**Post date:** [September 23, 2022, 10:23pm UTC](https://boards.straightdope.com/t/yet-another-odds-question-simulating-two-dice-rolls-with-a-deck-of-cards/972087/54 "2022-09-23T22:23:20Z")

</div>

> [@SunUp](#):
>
> Do you want:

The second. I need two independent results, but order doesn’t matter.

---

<div class="post-metadata">

**Author:** ![Dr.Strangelove](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/dr.strangelove/32/6613_2.png) [@Dr.Strangelove](https://boards.straightdope.com/u/Dr.Strangelove)\
**Post date:** [September 23, 2022, 10:24pm UTC](https://boards.straightdope.com/t/yet-another-odds-question-simulating-two-dice-rolls-with-a-deck-of-cards/972087/55 "2022-09-23T22:24:48Z")

</div>

Is that because you’re always using the sum, or the max of the two, or the min of the two, or something else?

---

<div class="post-metadata">

**Author:** ![Johnny\_Bravo](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/johnny_bravo/32/493_2.png) [@Johnny\_Bravo](https://boards.straightdope.com/u/Johnny_Bravo)\
**Post date:** [September 23, 2022, 10:26pm UTC](https://boards.straightdope.com/t/yet-another-odds-question-simulating-two-dice-rolls-with-a-deck-of-cards/972087/56 "2022-09-23T22:26:27Z")

</div>

No. Both values need be reserved for independent use at a later point.

---

<div class="post-metadata">

**Author:** ![SunUp](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@SunUp](https://boards.straightdope.com/u/SunUp)\
**Post date:** [September 23, 2022, 10:43pm UTC](https://boards.straightdope.com/t/yet-another-odds-question-simulating-two-dice-rolls-with-a-deck-of-cards/972087/57 "2022-09-23T22:43:19Z")

</div>

So: if they are used independently, it sounds like the order does - or will - matter.

Or will you use (for example) the highest, followed by the lowest? Will there be some other ordering you use for these values that isn’t “this one was rolled first”?

---

<div class="post-metadata">

**Author:** ![Johnny\_Bravo](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/johnny_bravo/32/493_2.png) [@Johnny\_Bravo](https://boards.straightdope.com/u/Johnny_Bravo)\
**Post date:** [September 23, 2022, 10:49pm UTC](https://boards.straightdope.com/t/yet-another-odds-question-simulating-two-dice-rolls-with-a-deck-of-cards/972087/58 "2022-09-23T22:49:37Z")

</div>

The order isn’t relevant.

Basically, it’s for a game. Two d20s are rolled. At any time in the future, the player may substitute the value of either die for other rolls. It’s a two-value ‘bank’ of replacement values for future dice rolls.

---

<div class="post-metadata">

**Author:** ![DPRK](https://avatars.discourse-cdn.com/v4/letter/d/4491bb/32.png) [@DPRK](https://boards.straightdope.com/u/DPRK)\
**Post date:** [September 23, 2022, 10:56pm UTC](https://boards.straightdope.com/t/yet-another-odds-question-simulating-two-dice-rolls-with-a-deck-of-cards/972087/59 "2022-09-23T22:56:23Z")

</div>

I think it would work OK with the 20 red + 20 black cards. If you shuffle each stack separately, the player could even just pick one from each, without having to examine or reject any.

---

<div class="post-metadata">

**Author:** ![SunUp](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@SunUp](https://boards.straightdope.com/u/SunUp)\
**Post date:** [September 23, 2022, 10:58pm UTC](https://boards.straightdope.com/t/yet-another-odds-question-simulating-two-dice-rolls-with-a-deck-of-cards/972087/60 "2022-09-23T22:58:22Z")

</div>

OK, I get it now. Plus, that’s a nice mechanic - just have the two cards out in the middle and a player can take the “duplicate” card first. As long as you exhaust the “bank” before replacing it, it works very elegantly.

[Previous page](https://boards.straightdope.com/t/yet-another-odds-question-simulating-two-dice-rolls-with-a-deck-of-cards/972087.md?page=2)

[Next page](https://boards.straightdope.com/t/yet-another-odds-question-simulating-two-dice-rolls-with-a-deck-of-cards/972087.md?page=4)
