There's a sort of magic trick involving doing perfect riffle shuffles where the whole deck retains it's order. If my memory is correct if you perform 8 perfect riffle shuffles (split deck 50/50, riffle one for one card correctly) then the order resets itself after 8 shuffles. It's usually only performed as a demonstration of skill by experienced card magicians than as a standalone trick.
The Math of Card Shuffling (2018)
51–60 of 65 posts
Re: The Math of Card Shuffling (2018)
#52There's a sort of magic trick involving doing perfect riffle shuffles where the whole deck retains it's order. If my memory is correct if you perform 8 perfect riffle shuffles (split deck 50/50, riffle one for one card correctly) then the order resets itself after 8 shuffles. It's usually only performed as a demonstration of skill by experienced card magicians than as a standalone trick.
Re: The Math of Card Shuffling (2018)
#53I've always shuffled three times due to hearing at some point in my childhood that 3 times was the max amount of shuffles needed to completely shuffle a deck. Recently I realized that doesnt check out but it's been hard to break the habit as more than 3 shuffles seems to take forever. 7 though? Wow.
Re: The Math of Card Shuffling (2018)
#54Re: The Math of Card Shuffling (2018)
#55Earlier quoted context omitted.
There are well known algorithms for shuffling cards, you don't need to reinvent it. Most online casinos use this: https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle https://www.rosettacode.org/wiki/Knuth_shuffle
Hey thanks for the article. What I mean though is that in real life people won’t shuffle the same way as the computer does so my online playtesting might be inaccurate. They’ll just do crap shuffling and cards will still be together in sets from the previous game - what I need is a bad / human shuffling algorithm that shuffles like lazy normal people do!
(ETA: One perfect naive algorithm example is directly in the article here: the riffle one card at a time algorithm. Select any n riffles less than the mean 236 and it is a guaranteed lazy/bad shuffle. Even selecting above the mean doesn't guarantee a perfect shuffle, again because of the properties of a computer PRNG.)
Re: The Math of Card Shuffling (2018)
#56Why does every card, on average, need to be ruffled in order for the dev to be randomized?
They also cover that overhand shuffles in practice require something like 10,000 shuffles to properly randomize. The problem is familiar to cryptographers: this scheme has "confusion" but not "diffusion". You can see this yourself: sort a deck of cards[1], then do two overhand shuffles in a row and splay out the cards and look at how random the result looks. They kind of "undid" each other, they "commuted" with each other or so.
If you want something a little more interesting, try to overhand shuffle with large cuts and then overhand shuffle with smaller cuts, and this gives somewhat more diffusion. Or just overhand-large, overhand-small, and then riffle -- the riffle will give you tremendous diffusion of the cut entropy created by the overhands. Anecdotally it seems somewhat unlikely that one gets to the full 220-something bits of randomness from only 7 riffles as that would require each riffle to have 30+ bits of entropy which seems... unlikely.
[1] you can do this fastest probably with a sort of omniscient quicksort: sort black/red, then sort black into spades/clubs, then sort spades into high/low, then sort the 6 low spades by eye, then sort the 7 high spades by eye, then sort clubs into high/low...
Re: The Math of Card Shuffling (2018)
#57There's a sort of magic trick involving doing perfect riffle shuffles where the whole deck retains it's order. If my memory is correct if you perform 8 perfect riffle shuffles (split deck 50/50, riffle one for one card correctly) then the order resets itself after 8 shuffles. It's usually only performed as a demonstration of skill by experienced card magicians than as a standalone trick.
Of course, this is dependent on perfect shuffles, which I'm sure I never achieve. Maybe the 'seven shuffles to randomize' calculation takes into account the 'human' nature of shuffling during a game? It is almost a sure thing the deck will never be split perfectly in half, and a perfect faro shuffle achieved.
Someone else mentioned that it depends on if it's an 'in' or an 'out' riffle as well, so I read the wiki page. The basically tells me you should always try to do an 'in' shuffle, I will have to start looking out for this :)
Re: The Math of Card Shuffling (2018)
#58What the article failed to mention is that a very common shuffling method - overhand shuffle - is terrible. You need about 10000 (ten thousand) of them to shuffle an ordinary deck of 52 cards. This can seriously impact you when playing board games, and collectible card games like Magic: the Gathering. In competitive CCGs it can make the game unfair. In non-competitive games it just makes it boring because the same si…
> You need about 10000 (ten thousand) of them to shuffle an ordinary deck of 52 cards. My source[0] says the lower bound for full overhand shuffle is number of cards squared, so less than 3000 shuffles for 52 cards. Upper bound around 5000. Your source? [0] https://arxiv.org/abs/math/0501401
Re: The Math of Card Shuffling (2018)
#59Re: The Math of Card Shuffling (2018)
#60There's a sort of magic trick involving doing perfect riffle shuffles where the whole deck retains it's order. If my memory is correct if you perform 8 perfect riffle shuffles (split deck 50/50, riffle one for one card correctly) then the order resets itself after 8 shuffles. It's usually only performed as a demonstration of skill by experienced card magicians than as a standalone trick.
Yes it's 8 perfect riffles. What the article doesn't seem to stress is that there are two different riffles—an in shuffle (top card moves to second) and an out shuffle (top card stays on top). It's only 8 with an out shuffle I think, but 52 with an in shuffle. So presumably their figure of 7 is referring to the in shuffle (as being 1 shuffle away from the original order doesn't sound too shuffled to me). The in shuff…
http://statweb.stanford.edu/~cgates/PERSI/papers/83_05_shuff...
I saw one of the authors, Persi Diaconis, give a talk on this paper, and then perform a perfect shuffle. I was floored.