Home▸Algorithms & AI▸Card Deck Shuffle: Fisher–Yates vs. Riffle vs. Overhand (2D)

Card Deck Shuffle: Fisher–Yates vs. Riffle vs. Overhand (2D)

2D card-shuffle lab: run a real 52-card deck through Fisher–Yates, a Gilbert–Shannon–Reeds riffle model, or an overhand shuffle, and watch inversions and ascending-run counts converge toward — or fail to reach — true randomness.

Algorithms & AI2DModerate60 FPS📱 Mobile-adapted⇄ 3D version
2d-card-deck-shuffle ↗ Open standalone

This 2D companion swaps the 3D version's looping riffle animation for the actual combinatorics behind shuffling: pick a real algorithm — uniform Fisher–Yates, a Gilbert–Shannon–Reeds riffle model, or a biased overhand shuffle — apply one or many passes, and watch two standard permutation statistics, inversions and ascending-run count, climb toward the values expected of a truly random 52-card arrangement (or, for the overhand shuffle, visibly fail to get there even after many passes).

⚙ Under the hood

52-card deck driven by three real shuffle algorithms — Fisher–Yates, a Gilbert–Shannon–Reeds riffle model, and an overhand shuffle — with live inversions and ascending-run counters (standard permutation-randomness statistics) tracked against their expected values for a uniformly random deck.

card shufflepermutationprobabilityfisher-yatesriffle shuffleinversions

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)