NHacker Next
  • new
  • past
  • show
  • ask
  • show
  • jobs
  • submit
Seven Perfect Shuffles Randomize a Deck of Cards. But How Many Sloppy Ones? (quantamagazine.org)
vessenes 54 minutes ago [-]
Ironically seven perfectly interleaved riffle shuffles will return a deck to its original order, so the title is spectacularly wrong for one famous result.

Also the new result is cool! (14 semi bad riffle shuffles are sufficient to mix)

PaulHoule 4 minutes ago [-]
Well I'd imagine a "perfect" shuffling procedure would have an equal probability of all 52! possible outputs which includes the original output and one would expect the sequence that gets you there would be highly symmetric.
zahlman 20 minutes ago [-]
It requires eight perfect riffle shuffles, not seven. (I just checked at the Python REPL.) And actually it depends on whether the riffles are done "in" or "out" (i.e. which half of the deck the new top card comes from).

I had understood that seven "typical" riffle shuffles produce good randomness.

RNanoware 4 hours ago [-]
Anecdotally, I find that certain card games are more enjoyable with the imperfections of human shuffling: when clumps naturally arise after playing, packing, and unpacking the game several times. An element of organic personality arises when you see a sequence of cards from a previous game. That human element is lost when a computer perfectly shuffles a deck into a never-before-seen orientation.
brookst 3 hours ago [-]
Games that sort the cards are the worst / most interesting for this. Gin rummy, etc, where the end result of a game is sorted groups of same-numbers and runs. You can really tell when then shuffling has just transposed a few cards.
soared 4 hours ago [-]
Upper limit of 14. I’m curious then - when playing cards with friends we start with a semi -random, but definitely clumped, deck. It gets shuffled a couple times.

How random is that deck? How many “cold spots” does it have? Just how not random of decks are people playing with, and ultimately does that even matter if players lack the knowledge or skill to change their play because of that knowledge?

capitol_ 4 hours ago [-]
Shouldn't a perfect shuffle just reorder the cards without adding entropy?

You would need sloppy ones to introduce randomness.

jtbayly 3 hours ago [-]
A "perfect shuffle" according to the article:

>The riffle shuffle has to follow a realistic but strict model where cards are randomly interleaved from the left or right pile one by one. (Each card gets dropped from either the left or the right pile with a probability that’s proportional to the number of cards remaining in that pile. This means that the cards don’t simply alternate between left and right, which would result in a predictable structure; instead, the order might go “left, right, right, left, right, left, left.”)

myrmidon 3 hours ago [-]
You misunderstood because the title is ambiguous.

This talks about seven consecutive riffle shuffles ("cut the deck and interleave the piles"): Those are not a "perfect shuffle" (i.e. same probability for every permutation) by themselves, only after doing them several times consecutively (which is kinda suprising by itself).

HPsquared 4 hours ago [-]
It's modelled with randomness, each card is taken from left or right with a probability, it's not a deterministic model.
soared 4 hours ago [-]
I don’t know on perfect shuffles but for the sloppy shuffles, the deck is cut at a random location between each shuffle.
aureate 4 hours ago [-]
See the paragraph beginning "Yet terms and conditions also apply."
empath75 2 hours ago [-]
Yeah, a "perfect" shuffle is known as a faro shuffle and it's the basis of a lot of magic tricks, but it's a weird looking shuffle and it sort of ruins the tricks once you can recognize it.
fartcoin67 3 hours ago [-]
shouldn't a perfect hackernews rtfa?
ecolonsmak 3 hours ago [-]
"...unique tracking label for every card in the deck"

I'd like more details on how this was accomplished on a practical level. Got me thinking about how to embed trackers thin enough to go into a playing card that would operate like a mesh network then the deck could self report once it's properly randomized making a green light go off indicating play may begin.

layer8 3 hours ago [-]
They didn’t do this practically, the “tracking label” is just an analogy to convey what they did mathematically. The word “barcode” is also only used because it might be more accessible to the layperson than “bit sequence”.
hdndjsbbs 2 hours ago [-]
This is just the authors explanation to explain how to encode where a card ends up. The cards don't actually have barcodes, they have a binary-encoded number where a 0 indicates the left pile and 1 indicates the right pile during a specific round of the shuffle. The number encodes the journey that card makes during the shuffle. It's not an actual barcode.
empath75 2 hours ago [-]
There are actually "marked" decks you can buy that come with an iphone app that tell you exactly where every card on the deck is by looking at the side.
WorldMaker 25 minutes ago [-]
Marked decks are an ancient tradition for both cheaters and magicians. There are also ways to mark a deck that aren't obvious to most people with a casual inspection and that don't need an app to read from the edge.
chadgpt3 2 hours ago [-]
AI written? Em dashes, it's not X it's Y
zeroonetwothree 2 hours ago [-]
Username checks out
have_faith 4 hours ago [-]
And 8 perfect shuffles resets it back to starting order (perfect being cards interlaced 1 by 1)
brookst 3 hours ago [-]
So just do -1 shuffles and save yourself a lot of effort?
3 hours ago [-]
3 hours ago [-]
HPsquared 4 hours ago [-]
Quite the assumption here: "cards are randomly interleaved from the left or right pile one by one. (Each card gets dropped from either the left or the right pile with a probability that’s proportional to the number of cards remaining in that pile."

... Why would it be proportional to the number of cards in each pile? (Edit: I suppose the person doing the shuffling might adjust the rate of cards coming from each hand ... But not perfectly and continuously)

fwlr 3 hours ago [-]
If there is one card in this pile and no cards in the other, the probability of dropping the card from this pile is one. If instead there are some cards still in the other, a) the probability is less than one, and b) we move one step closer to the first state. So by construction it must be proportional - perhaps a poorly behaved proportionality, but that is still enough for the math to work.
tobr 4 hours ago [-]
> But not perfectly and continuously

Isn’t that where the randomness comes in?

HPsquared 58 minutes ago [-]
The randomness comes from sampling the probabilities. The strange assumption is that the probabilities are exactly proportional to number of cards currently in each stack.
zahlman 17 minutes ago [-]
It's the simplest model that gives the right result for simple cases (e.g. once one pile is empty, the remaining cards must come from the other pile; and when they're evenly split, it should be a coin flip). It also entails, for example, that when there are N cards in one pile and one in the other, the single card gets placed in each possible spot with equal probability. (This recalls the old trick for getting a random line from a text file without pre-counting anything.)
3 hours ago [-]
layer8 7 hours ago [-]
mrbluecoat 3 hours ago [-]
TL;DR "roughly 14"
Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact
Rendered at 16:28:09 GMT+0000 (Coordinated Universal Time) with Vercel.