Live data from Hacker News

The Math of Card Shuffling (2018)

fredhohman.com

21–30 of 65 posts

Re: The Math of Card Shuffling (2018)

#21

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

Re: The Math of Card Shuffling (2018)

#22

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.

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?

Re: The Math of Card Shuffling (2018)

#23

An interesting bit if history. Electronic card shuffles were invented by a former truck driver. Casinos rented the devices from his company I don't think any were sold (their value was approximately $20,000 each). I haven't worked at a casino for four years but at that time I beleive the market opened up. It sounds like a patent expired or maybe the fisr card shuffle company was sold.

You can buy card shufflers on Amazon for under twenty dollars. I've only used one once and geez was it loud - hopefully they do not all have that issue.

https://www.amazon.com/card-shuffler-automatic-card-shuffler...

Re: The Math of Card Shuffling (2018)

#24

Earlier quoted context omitted.

> 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

Well, it seems that his point still stands. Overhand shuffle is terrible for actually shuffling a deck of cards.

Assuming 4 shuffles per second, 3000 shuffles would take about 12.5 minutes, while 10000 shuffles would take more than 40 minutes. One of those sounds feasible during a break on a casual game night.

Of course, those numbers apply only if the shuffle is done literally—I personally try to mix individual cards by letting one hand’s batch cut in-between the other’s (and I think I’m not the only one)—but I’m still curious where did those 10000 come from.

Re: The Math of Card Shuffling (2018)

#25
post #9

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.

Yup! That's correct, here's a demonstration: https://www.youtube.com/watch?v=rEoYwyHddLc Explaining why it works is an exercise in number theory. For example, card 1 stays in place; card 2 goes to position 3, then 5, then 9, then 17, ... In short, the reason why it works is that 2^8 - 1 is divisible by 52 - 1.

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.

Re: The Math of Card Shuffling (2018)

#29
post #9

Earlier quoted context omitted.

Yup! That's correct, here's a demonstration: https://www.youtube.com/watch?v=rEoYwyHddLc Explaining why it works is an exercise in number theory. For example, card 1 stays in place; card 2 goes to position 3, then 5, then 9, then 17, ... In short, the reason why it works is that 2^8 - 1 is divisible by 52 - 1.

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
Post reply on HN