← Quanta Magazine

Seven Perfect Shuffles Randomize a Deck of Cards. But How Many Sloppy Ones?

七次完美的洗牌可以随机化一副牌。但有多少马虎的人呢?
2026-06-17  ·  Quanta Magazine  ·  原文

The magician Noah Levine performs a riffle shuffle.

魔术师诺亚·莱文表演洗牌。

Samuel Velasco and Chris Young /Quanta Magazine; all inset illustrations from The Expert at the Card Table by S.W.

Samuel Velasco and Chris Young /Quanta Magazine;所有插图均来自 S.W. 的《牌桌上的专家》

Erdnase.

埃尔德纳酶。

In 1992, mathematicians famously proved that seven “riffle shuffles” — the kind where a player splits a deck of cards into two piles, then uses their thumbs to interleave them back together in a zipperlike motion — are enough to mix up the deck.

1992 年,数学家们著名地证明,七次“riffle shuffles”(即玩家将一副纸牌分成两堆,然后用拇指以拉链般的动作将它们重新交错在一起)足以将这副牌打乱。

When Dave Bayer and Persi Diaconis came up with this proof, they also revealed something surprising about what happens along the way: At first, the cards stay relatively orderly.

当 Dave Bayer 和 Persi Diaconis 提出这个证明时,他们还揭示了沿途发生的一些令人惊讶的事情:首先,卡片保持相对有序。

But with that seventh shuffle, the deck suddenly tips into a highly unstructured state.

但随着第七次洗牌,牌组突然陷入高度无组织的状态。

This kind of behavior, called a cutoff phenomenon, is of interest beyond cards, and many dynamical systems — including “ spin glasses ” in condensed matter physics — are believed to exhibit it .

这种被称为截止现象的行为在卡片之外引起了人们的兴趣,许多动力系统——包括凝聚态物理中的“自旋玻璃”——被认为表现出了这种现象。

Unfortunately, Bayer and Diaconis’ proof — referred to by some as a mathematical miracle — only works if you adhere to some rigid constraints about how to cut and shuffle the deck.

不幸的是,拜耳和迪亚科尼斯的证明——被一些人称为数学奇迹——只有在你遵守一些关于如何切牌和洗牌的严格限制的情况下才有效。

If you shuffle more like a middle schooler than a magician, the result doesn’t hold.

If you shuffle more like a middle schooler than a magician, the result doesn’t hold.

Sloppy shufflers, fret not: A new proof confirms how many shuffles it takes to randomize an imprecisely cut deck.

Sloppy shufflers, fret not: A new proof confirms how many shuffles it takes to randomize an imprecisely cut deck.

Now three mathematicians have finally extended the finding to less precise shuffles.

现在,三位数学家终于将这一发现扩展到不太精确的洗牌上。

Mark Sellke , a Harvard University statistician currently on leave to work at OpenAI, along with Jialu Shi and Jiamin Wang (graduate students at the University of Cambridge and Princeton University, respectively), proved that a cutoff phenomenon exists for riffle shuffling even when you don’t cut the deck into two nice, even piles.

目前正在 OpenAI 工作的哈佛大学统计学家 Mark Sellke 与 Jialu Shi 和 Jiamin Wang(分别是剑桥大学和普林斯顿大学的研究生)一起证明了即使你没有将牌切分成漂亮、均匀的两堆,洗牌也存在切断现象。

Diaconis was effusive about the update to his work.

迪亚科尼斯对他的工作的更新热情洋溢。

“It’s a fresh idea, and it’s remarkable that something like that would work as effectively as it does,” he said.

他说:“这是一个新鲜的想法,而且类似的东西能如此有效地发挥作用真是太棒了。”

“It’s a brilliant piece of mathematics.”

“It’s a brilliant piece of mathematics.”

To call the humble riffle shuffle “complicated” sells it absurdly short.

To call the humble riffle shuffle “complicated” sells it absurdly short.

The number of possible arrangements for an ordinary deck of cards is 52 factorial — that is, 52 × 51 × 50 × …

The number of possible arrangements for an ordinary deck of cards is 52 factorial — that is, 52 × 51 × 50 × …

× 3 × 2 × 1, or (roughly speaking) an 8 followed by 67 zeros, close to the estimated number of atoms in our galaxy.

× 3 × 2 × 1, or (roughly speaking) an 8 followed by 67 zeros, close to the estimated number of atoms in our galaxy.

Another way to put the figure into context: Every time you shuffle a deck of cards, you produce a configuration that has almost certainly never existed before, and never will again.

另一种将这个图放到上下文中的方法是:每次你洗一副牌时,你都会产生一个几乎可以肯定以前从未存在过、也永远不会再存在的配置。

But mathematical interest in card shuffling goes beyond its combinatorial complexity.

But mathematical interest in card shuffling goes beyond its combinatorial complexity.

Back in 1981, Diaconis and Mehrdad Shahshahani discovered cutoff phenomena in the context of card shuffling — after which mathematicians started to uncover them all over the place.

早在 1981 年,Diaconis 和 Mehrdad Shahshahani 就发现了洗牌过程中的截止现象,此后数学家们开始在各地发现它们。

Persi Diaconis ran away from home when he was 14 years old to work with a magician.

佩尔西·迪亚科尼斯 (Persi Diaconis) 14 岁时离家出走,跟随一位魔术师工作。

He returned to school 10 years later and became a professional mathematician.

He returned to school 10 years later and became a professional mathematician.

Card tricks continue to play a role in his research.

Card tricks continue to play a role in his research.

Cutoffs are similar to phase transitions in physics, such as the sudden crystallization of liquid water into solid ice at zero degrees Celsius.

截止值类似于物理学中的相变,例如液态水在零摄氏度下突然结晶成固态冰。

But cutoffs occur in the specific mathematical context of “ Markov chains ,” mathematical models that probabilistically describe how a system (like a deck of cards) moves between different configurations.

但截断发生在“马尔可夫链”的特定数学背景中,这种数学模型概率性地描述了系统(如一副纸牌)如何在不同配置之间移动。

Cutoff phenomena, as their name suggests, happen in much the same way as Ernest Hemingway famously described going bankrupt: gradually, then suddenly.

顾名思义,中断现象的发生方式与欧内斯特·海明威著名的破产描述非常相似:逐渐,然后突然。

And while cutoffs are ubiquitous — they’re expected to occur in “most large, complex systems,” according to Sellke — it’s also hard to prove general theorems about them.

尽管中断无处不在——根据塞尔克的说法,它们预计会出现在“大多数大型、复杂的系统”中——但也很难证明关于它们的一般定理。

“For most problems where one thinks there is a cutoff,” said Laurent Saloff-Coste , a mathematician at Cornell University who has collaborated with Diaconis, “one doesn’t know how to prove it.”

与 Diaconis 合作过的康奈尔大学数学家 Laurent Saloff-Coste 表示:“对于大多数人们认为存在截止点的问题,人们不知道如何证明这一点。”

That’s why the “seven shuffles are enough” theorem was such a big deal.

这就是为什么“七次洗牌就足够了”定理如此重要。

Bayer and Diaconis — who as a teenager ran away from home to apprentice with a magician specializing in card tricks , before becoming a renowned mathematician — didn’t just prove the existence of a precise cutoff in a real-world system.

拜耳和迪亚科尼斯——青少年时期离家出走,跟随一位专门研究纸牌戏法的魔术师当学徒,后来成为著名数学家——不仅仅证明了现实世界系统中精确截止的存在。

They provided a single formula for where that cutoff should be, and that formula worked for decks of any size.

They provided a single formula for where that cutoff should be, and that formula worked for decks of any size.

Yet terms and conditions also apply.

Yet terms and conditions also apply.

One: 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.”)

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.”)

Two: The deck has to be cut more or less in half before shuffling.

第二:洗牌之前,必须将这副牌或多或少地切成两半。

“All of our analysis depends on those details,” Diaconis said.

“All of our analysis depends on those details,” Diaconis said.

In 1999, Steven Lalley , a mathematician at the University of Chicago, attempted to loosen those constraints by seeking a cutoff proof for riffle shuffles that didn’t start with roughly evenly cut decks.

1999 年,芝加哥大学数学家史蒂文·拉利 (Steven Lalley) 试图通过寻找 riffle 洗牌的截止证明来放松这些限制,该洗牌并不是从大致均匀切割的牌组开始的。

“It seemed natural to me to ask — there are some people who tend to cut the deck a little higher or a little lower,” he said.

“对我来说,这个问题似乎很自然——有些人倾向于把甲板剪得高一点或低一点,”他说。

These less evenly cut decks have sets of cards that tend to stay in the same relative order even after multiple shuffles.

These less evenly cut decks have sets of cards that tend to stay in the same relative order even after multiple shuffles.

While the rest of the deck looks well mixed, these particular sets of cards — which Lalley called “cold spots” — still retain information about their original locations in the deck.

虽然这副牌的其余部分看起来混合得很好,但这些特殊的牌组——拉利称之为“冷点”——仍然保留了它们在牌组中原始位置的信息。

Imagine, for instance, that you label your cards 1 through 52.

Imagine, for instance, that you label your cards 1 through 52.

After multiple shuffles, cards 16 and 17 will no longer appear right next to each other in the deck, but 16 might still tend to appear before 17 more often than it would in a random deck.

多次洗牌后,牌 16 和 17 将不再在牌组中紧挨着出现,但与随机牌组中相比,16 可能仍会更频繁地出现在 17 之前。

If many pairs within a section of the original deck — say, cards 15 through 25 — show similar biases, then that set of cards forms a cold spot.

如果原始牌组中的许多对(例如,第 15 到 25 张牌)显示出类似的偏差,那么该组牌就会形成冷点。

Lalley hoped to prove that when those cold spots disappeared, so would the last traces of order in the deck — giving him a way to show the existence of a cutoff.

拉利希望证明,当这些冷点消失时,牌组中最后的秩序痕迹也会消失——这给了他一种方法来证明截止点的存在。

Two decades later, in 2019, the son of Lalley’s collaborator Thomas Sellke — Mark, then a graduate student at Stanford University — found himself in one of Diaconis’ classes, where he learned about the original seven-shuffles result.

二十年后的 2019 年,拉利的合作者托马斯·赛尔克 (Thomas Sellke) 的儿子马克 (Mark),当时是斯坦福大学的研究生,发现自己在戴科尼斯的一堂课上,在那里他了解到了最初的七次洗牌结果。

“He mentioned offhandedly that if you don’t cut the deck in half, then nothing [about the proof] works anymore,” Mark Sellke recalled.

“He mentioned offhandedly that if you don’t cut the deck in half, then nothing [about the proof] works anymore,” Mark Sellke recalled.

“I was like, ‘This is it?

“我当时想,‘就是这个吗?

…

……

Come on, we must be able to do this.’”

来吧,我们一定能做到。”

By 2021, Mark Sellke had pinpointed the cutoff for decks cut much more unevenly than those in Bayer and Diaconis’ original work — including for decks cut into more than two piles.

到 2021 年,马克·塞尔克 (Mark Sellke) 精确地指出了比拜耳和迪亚科尼斯最初的工作中切割得更不均匀的甲板的截止点,包括切割成两堆以上的甲板。

But the deck still had to be cut in the same way between each shuffle.

But the deck still had to be cut in the same way between each shuffle.

He wanted a more realistic result, where the cuts from one shuffle to the next might look very different.

He wanted a more realistic result, where the cuts from one shuffle to the next might look very different.

And so in the summer of 2024, he teamed up with Shi and Wang, who had also expressed interest in the problem.

And so in the summer of 2024, he teamed up with Shi and Wang, who had also expressed interest in the problem.

The trio first assigned each card a barcode.

三人首先为每张卡分配了一个条形码。

It starts when you cut the deck.

当你切割甲板时它就开始了。

All the cards in the left pile get assigned the number 1; those on the right, zero.

All the cards in the left pile get assigned the number 1; those on the right, zero.

Now shuffle, randomly interleaving the cards from the two piles one by one.

Now shuffle, randomly interleaving the cards from the two piles one by one.

Cut the deck again.

再次切割甲板。

If a card ends up in the left pile, add a 1 to its label; if it ends up in the right pile, add a zero.

If a card ends up in the left pile, add a 1 to its label;如果它最终出现在正确的一堆中,请添加一个零。

As this process repeats through more riffle shuffles, each card builds up a longer and longer barcode of ones and zeros, which encodes its path through the shuffling process as it hops from left to right and back again.

随着这个过程通过更多的重复洗牌重复进行,每张卡都会构建出越来越长的 1 和 0 条形码,当它从左到右跳跃并再次返回时,它会对其通过洗牌过程的路径进行编码。

For instance, if the 17th card has a barcode of 0110 after four shuffles, that means it started in the right pile, ended up on the left twice, and then landed back on the right.

例如,如果第 17 张牌经过四次洗牌后条形码为 0110,则意味着它从右侧一堆开始,两次在左侧结束,然后又回到右侧。

These numbers create a unique tracking label for every card in the deck.

These numbers create a unique tracking label for every card in the deck.

If two cards that started out in the same relative order — say, 16 and 17 — end up with the same barcode of ones and zeros, that means they took the exact same path through the shuffling process and are still in the same relative order.

如果两张以相同相对顺序开始的牌(例如 16 和 17)最终具有相同的 1 和 0 条形码,则意味着它们在洗牌过程中采取了完全相同的路径,并且仍然处于相同的相对顺序。

To prove the presence of a cutoff, you have to show that very few of those matching barcodes remain after a certain number of shuffles — no matter how many cards you started with, or how the deck was cut.

为了证明存在截止点,您必须证明在经过一定次数的洗牌后,匹配的条形码中几乎没有保留下来 - 无论您开始有多少张牌,或者牌组是如何切割的。

But comparing every barcode is time-consuming.

但比较每个条形码非常耗时。

Fortunately, the cold spots offer a shortcut, just as Lalley had hoped.

Fortunately, the cold spots offer a shortcut, just as Lalley had hoped.

Since those are the regions in the deck that tend to resist mixing, they’re the only places you have to check for barcodes that match.

Since those are the regions in the deck that tend to resist mixing, they’re the only places you have to check for barcodes that match.

Start with a deck of n cards and list the barcodes of all the cards in the deck’s cold spots in ascending order.

Start with a deck of n cards and list the barcodes of all the cards in the deck’s cold spots in ascending order.

Then use that information to build a collection of points and lines, called a graph.

Then use that information to build a collection of points and lines, called a graph.

Represent each card (labeled with its barcode) as a point.

Represent each card (labeled with its barcode) as a point.

Connect two points with an edge if they have the same barcode, to reflect the fact that the corresponding pair of cards has still not gotten mixed up.

如果两个点具有相同的条码,则用一条边将它们连接起来,以反映相应的一对卡片仍未混淆的事实。

Repeat this process with a second deck of n cards.

Repeat this process with a second deck of n cards.

Then line up the graphs representing both decks and identify where they overlap.

Then line up the graphs representing both decks and identify where they overlap.

These overlaps indicate how long both decks continue to resist mixing.

These overlaps indicate how long both decks continue to resist mixing.

Sellke, Shi, and Wang then showed that after a certain number of shuffles (which depended on how many cards were in the deck), the overlap between the decks’ regions of unmixed cards disappeared at an exponential rate.

Sellke、Shi 和 Wang 随后表明,经过一定次数的洗牌(这取决于牌组中有多少张牌),牌组中未混合牌的区域之间的重叠以指数速度消失。

This so-called exponential tail, according to Sellke, gave them an upper bound on the number of shuffles it would take to dissolve the last bits of orderliness in a typical deck.

根据塞尔克的说法,这种所谓的指数尾部给了他们一个上限,即消除典型牌组中最后一点秩序所需的洗牌次数。

According to the new proof, that ceiling is roughly 14 riffle shuffles for a 52-card deck, if you cut your deck in a random place with each shuffle.

根据新的证据,如果你在每次洗牌时随机切牌,那么对于 52 张牌的牌组来说,上限大约是 14 次 Riffle 洗牌。

Beyond that point, the cards will be fully mixed.

Beyond that point, the cards will be fully mixed.

“For me the motivation is pretty simple,” Sellke said.

“For me the motivation is pretty simple,” Sellke said.

“I occasionally play poker with my friends, and I want to know how many times I should be shuffling my cards.”

“I occasionally play poker with my friends, and I want to know how many times I should be shuffling my cards.”

“It’s spectacular,” Lalley said.

“这太壮观了,”拉利说。

“I’ve known Mark ever since he was a young kid.

“I’ve known Mark ever since he was a young kid.

The problem sat there for 26 years, and finally he cracked it.”

The problem sat there for 26 years, and finally he cracked it.”

Technically speaking, there’s still work to be done.

Technically speaking, there’s still work to be done.

The model of shuffling that the new result depends on, like Bayer and Diaconis’ before it, still assumes that the cards riffle down one by one, rather than in clumps.

新结果所依赖的洗牌模型,就像拜耳和迪亚科尼斯之前的洗牌模型一样,仍然假设纸牌是一张一张地洗牌,而不是成团洗牌。

That level of shuffling skill is beyond what most casual card players possess (although well within Diaconis’ own powers, as he made sure to note).

这种洗牌技巧超出了大多数休闲纸牌玩家的能力(尽管正如戴科尼斯所指出的那样,这完全在他自己的能力之内)。

Sellke said he’s “very interested” in attacking this version of the problem as another way to generalize the cutoff phenomenon in card shuffling.

塞尔克表示,他“非常有兴趣”解决这个版本的问题,作为推广洗牌中截止现象的另一种方法。

“I really like this clumpy shuffle question,” he said.

“I really like this clumpy shuffle question,” he said.

“I haven’t made progress for a while.

“我已经有一段时间没有进步了。

Maybe after someone makes a bit of headway, then we can try again to adopt the understanding we’ve already produced.”

Maybe after someone makes a bit of headway, then we can try again to adopt the understanding we’ve already produced.”

Get highlights of the most important news delivered to your email inbox

获取发送到您的电子邮件收件箱的最重要新闻的摘要

Quanta Magazine moderates comments to facilitate an informed, substantive, civil conversation.

《Quanta》杂志对评论进行审核,以促进知情、实质性、文明的对话。

Abusive, profane, self-promotional, misleading, incoherent or off-topic comments will be rejected.

辱骂、亵渎、自我推销、误导、语无伦次或偏离主题的评论将被拒绝。

Moderators are staffed during regular business hours (New York time) and can only accept comments written in English.

版主在正常工作时间(纽约时间)有工作人员,并且只能接受英文评论。

中文为机器翻译,仅供参考。