Live data from Hacker News

The Math of Card Shuffling (2018)

fredhohman.com

41–50 of 65 posts

Re: The Math of Card Shuffling (2018)

#42

Earlier quoted context omitted.

And then you consider a game like blackjack where you often have six decks in play, 312! combinations instead of 52!. Interesting question just popped into my head, if the orientation of the card matters, how do people randomize that?

312! is way too high - there are 6 indistinguishable copies of each of 52 cards, not 312 unique cards.

(6 * 52)! / (6! ^ 52)

Re: The Math of Card Shuffling (2018)

#43
Also interesting here is that the number of single-riffles taken is expressed as a harmonic series, which in the limit can be simplified for 52 * (log(52) + .57) (where .57 is the Euler gamma constant). So this approach of shuffling is O(n log n), which is also the expected complexity of putting the deck back in order with pairwise sorting.

Re: The Math of Card Shuffling (2018)

#44
post #11

Earlier quoted context omitted.

On the other hand, with sleeved cards - you can do a "direct" rifle by "cutting" one half of the deck directly into the other (looks a bit like the overhand shuffle, acts more like a riffle). Something like the second method here ("smash"? Shuffle). Note that the riffle shuffle is also pretty easy with sleeved cards, you just need to modify the technique a bit. https://youtu.be/nnVABY_a6IQ?t=2m21s

I play a lot of Magic and usually I do this. It’s hard to riffle shuffle a double sleeved 99 card library.

Much easier with a 40 card Limited deck or even a 60 Constructed deck ;)

Re: The Math of Card Shuffling (2018)

#46

I'm designing a card game at the moment and have been pondering this because I'm doing play testing online, so the shuffling is done by a computer and is therefore perfectly random. I'm wondering how having non-perfect shuffling will affect the game play when it's a real world game and card combinations end up being left together.

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!

Re: The Math of Card Shuffling (2018)

#48

The link in this to another article about the number of different combinations of cards is mind blowing. I mean, I know I should probably have realised that really, but I didn't think it would be such a beyond-astronomical number of potential orders.

This page has a "workflow" you can go through to get a sense of how big 52! really is

http://czep.net/weblog/52cards.html

Re: The Math of Card Shuffling (2018)

#49

Earlier quoted context omitted.

What amazing control in that video. From the very start, spreading the cards so evenly that every single card can be shown to be in order, then even more the precision needed to riffle the cards together perfectly eight times.

It you want to see more amazing, Ricky Jay could do this while keeping up a stream of amusing patter and making his hand motions seem almost casual. E.g. https://www.youtube.com/watch?v=eonlrksCsw8

Richard Turner does it with patter, casual motions, and while being blind.

https://en.wikipedia.org/wiki/Richard_Turner_(magician)

Re: The Math of Card Shuffling (2018)

#50
post #28

So 7 riffles can produce every permutation equiprobably, right? Is there a smaller number of riffles that can produce every permutation, not necessarily equiprobably?

I don't think the arrangements are equiprobable. Well-distributed, likely.

Heuristically, there are a finite number of outputs of a riffle shuffle (probably fairly large; basically the number of different ways that you can clump cards together, 52^20 or thereabouts). But any finite number of outputs raised to the 7th power is not going to divide 52 factorial, in terms of the number of output possibilities.

Post reply on HN