Jump to content
BrainDen.com - Brain Teasers
  • 0

Shuffling a Deck of Cards


BMAD
 Share

Question

18 answers to this question

Recommended Posts

  • 0

I am referring to "riffle shuffles". The random riffle shuffle is modeled by cutting the deck binomially and dropping cards one-by-one from either half of the deck with probability proportional to the current sizes of the deck halves.

How many shuffles must be done, to where every possible card configuration is possible?

Link to comment
Share on other sites

  • 0

I am referring to "riffle shuffles". The random riffle shuffle is modeled by cutting the deck binomially and dropping cards one-by-one from either half of the deck with probability proportional to the current sizes of the deck halves.

How many shuffles must be done, to where every possible card configuration is possible?

Minimum, maximum, or expected number of riffle shuffles? I assume the minimum and expected number are of the greatest interest. As it is possible to preserve the starting order through a riffle shuffle as described (the trivial shuffle), there is no defined maximum. The minimum is also not so useful, as each shuffle can add entropy to the order from 0 to some maximum value per shuffle.

As an estimate, it would be interesting to run a simulation to see how many shuffles, on average, are required to move the top card to the bottom of the deck, or the bottom card to the top. This is not directly related to the question, but might be one of the harder cases, and might therefore estimate the order of magnitude needed for the OP.

Analytic analysis is beyond me at the moment, even if I had the time.

Link to comment
Share on other sites

  • 0

My view on this - and I am not inclined to calculate the probability myself - is that when the probability of finding the bottom card in the pile at the top of the pile is exactly 1/52, that is when we can consider the pack to be truly random. The easiest way I can see is to calculate the expected 'position increase' for a single card per shuffle (I feel this would be different for each card depending on its position) and find a summation until the bottom card has a 1/52 chance of rising to the top. I hope there is a more elegant solution.

Link to comment
Share on other sites

  • 0

If random implies that there is a non-zero probability of finding any given card at the top of the pile (or at any position), then the answer would be that this takes minimum of 2 shuffles. The first shuffle would be where the bottom card ends up in position 27. and the second shuffle where it gets shuffled in to the deck last. With 2 shuffles, I posit that there is a non-zero possibility for any card to have any position. In other words, after 2 shuffles you cannot guarantee that a given position will not be a given card.

Cheers!

Link to comment
Share on other sites

  • 0

If random implies that there is a non-zero probability of finding any given card at the top of the pile (or at any position), then the answer would be that this takes minimum of 2 shuffles. The first shuffle would be where the bottom card ends up in position 27. and the second shuffle where it gets shuffled in to the deck last. With 2 shuffles, I posit that there is a non-zero possibility for any card to have any position. In other words, after 2 shuffles you cannot guarantee that a given position will not be a given card.

For a ripple shuffle, it would take more than two shuffles to gurantee a random situation (every possible orientation of cards) is possible

Cheers!

Link to comment
Share on other sites

  • 0

instead of 52 cards, let's try 10.

for 10 cards, if you break them in half and then perform the ripple shuffle,

the top card could be anywhere from the top of the deck to the half way point (the 5th card.)

however, ending at the half way point would be the worst case senario, as when you cut to shuffle again, the middle card is on top again.

my guess then would be 3. once to get the top card close to the mid point, another to get it a good distance toward the bottom, and then a third to finish the possible transition.

Link to comment
Share on other sites

  • 0

Will take 2 shuffles. One to bring it to position 5. The second to bring it to the bottom. Not sure why you need the third shuffle...?


phil1882, on 28 May 2013 - 11:37 PM, said:


instead of 52 cards, let's try 10.
for 10 cards, if you break them in half and then perform the ripple shuffle,
the top card could be anywhere from the top of the deck to the half way point (the 5th card.)
however, ending at the half way point would be the worst case senario, as when you cut to shuffle again, the middle card is on top again.

my guess then would be 3. once to get the top card close to the mid point, another to get it a good distance toward the bottom, and then a third to finish the possible transition.

Link to comment
Share on other sites

  • 0

I am referring to "riffle shuffles". The random riffle shuffle is modeled by cutting the deck binomially and dropping cards one-by-one from either half of the deck with probability proportional to the current sizes of the deck halves.

How many shuffles must be done, to where every possible card configuration is possible?

I came to know that shuffle by the name “perfect shuffle.” Of course, you should start dropping the cards from the top half, so that the top card does not end up in the same position after the shuffle.

I wouldn't call that shuffle “random.” For a deck of 52, it takes 26 perfect shuffles to put it in exact reverse order and 52 shuffles total to return the deck to its original state.

For the powers of 2, the number of perfect shuffles required to return a deck into its original state is logarithm base 2.

E.g., a popular Russian game Proferans (“preference”) is played with a deck of 32 cards. Thus it takes only 5 perfect shuffles to return it to the starting order. I've met some gamblers who spent years practicing (while serving their jail sentences) to be able to make that shuffle every time.

In your favorite spreadsheet application, fill column “A” with numbers 1 through 52. Fill 52 cells in column “B” with formulas: =A27, =A1, =A28, =A2,... and so on. Select column “B” and drag it over the next 51 columns. You got all 52 permutations of perfect shuffles for a deck of 52 cards. If you know the starting order and the number of shuffles, you can tell the exact sequence of cards. What randomness is in that?

Conversely, I've read somewhere that you need at least 7 riffle shuffles to randomize the deck.

Link to comment
Share on other sites

  • 0

Wolfram suggests seven gets you very close. Theoretically, (3/2) ln 52.

Once you require a "perfect" shuffle, the only randomness is the choice of in-shuffle or out-shuffle (where top and bottom cards never move.) Every card moves to a known position, and all you do is calculate whether a particular permutation of the first 52 integers is random.

I'm interested to think what happens when the shuffle itself is random -- anything from "perfect riffle" to cutting the deck at a random card, thus interleaving any number of cards from 1 to 51. A single shuffle could then put the bottom card on top, or vv. You could assign a distribution of probabilities governing what happens, but that is all.

Link to comment
Share on other sites

  • 0

If a deck of 52 cards is cut exactly in half (top half and bottom half),

then the top half can be partitioned into T segments (keeping the order

of the cards) and, similarly, the bottom half can be partitioned into B

segments. If T=B then there are two ways to interleave these partitions

of cards -- dropping segments of cards alternately from T and B, beginning

with T (the first way) or beginning with B (the second way). If T=B+1,

then there is only one way to interleave the segments -- one must begin

with T. If T+1=B, one must begin with B. Any other relationship between

T and B make them impossible to interleave. We can count the number of

partitions of 26 in all possible arrangements, they are:

#partitions of 26; #of ways to make partitions of this number respecting order

1 1

2 25

3 300

4 2300

5 12650

6 53130

7 177100

8 480700

9 1081575

10 2042975

11 3268760

12 4457400

13 5200300

14 5200300

15 4457400

16 3268760

17 2042975

18 1081575

19 480700

20 177100

21 53130

22 12650

23 2300

24 300

25 25

26 1

We can now count all possible T,B pairs where T and B are at most one

apart. This gives us a grand total of 374,369,872,911,804 possible

riffle shuffles of 52 cards. Considering that 52! is the enormous

80658175170943878571660636856403766975289505440883277824000000000000,

I can't see how to show that there is some number, N, of riffle shuffles

such that one can always produce any particular permutation of the 52!

by applying at most N riffle shuffles to the identity permutation.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...