The house keeps an edge on every game. No staking system removes it.

18+Adults only

How online card games are shuffled: RNG and the Fisher-Yates method

An online card game shuffles by running a random number generator through an algorithm, most often Fisher-Yates, which gives each of the 52! possible deck orders the same chance. Mistakes such as a naive swap loop, modulo bias or a short seed make some orders likelier. Kenyan regulations require the generator to be certified.

What an online shuffle is

A software card game has no hands and no cards. It holds a list of 52 card labels (or 416 for an eight-deck shoe) and rearranges the list with numbers from a random number generator. The rearranged list is the shuffled deck, and cards are dealt from it in order.

Two separate parts decide whether this is fair: the generator that supplies the numbers, and the algorithm that turns the numbers into a deck order. The first is covered in what a pseudo-random number generator is. This guide explains the second, and how the two fail together.

How many deck orders are there

Put 52 cards in a row. The first place can hold any of 52 cards, the second any of the remaining 51, the third any of 50, and so on to the last place, which has 1 card left. The number of orders is 52 × 51 × 50 × ... × 2 × 1, written 52!.

That product is about 8.07 × 1067, a number with 68 digits. A fair shuffle gives each of those orders a probability of 1 in 52!. For smaller decks the count is easy to check by hand, as the table shows.

CardsCalculationPossible orders
33 × 2 × 16
44 × 3 × 2 × 124
55 × 4 × 3 × 2 × 1120
5252 × 51 × ... × 1about 8.07 × 1067

The Fisher-Yates method, step by step

Fisher-Yates (also called the Knuth shuffle) builds the order one place at a time. Number the places 0 to 51. Start at the last place, pick a random place from 0 up to and including the current one, swap the two cards, then move one place down and repeat until place 1 is done.

At the last place there are 52 choices, at the next 51, then 50, and the last step has 2. The total number of different choice sequences is 52 × 51 × ... × 2, which is 52!, and each sequence leads to a different final order. So every order is reached by exactly one sequence of choices. If each choice is uniform, every order has probability 1 in 52!.

Illustrative example

Take three cards A, B, C in places 0, 1, 2. Fisher-Yates picks a random place from 0 to 2 for place 2 (3 choices), then from 0 to 1 for place 1 (2 choices). That is 3 × 2 = 6 choice sequences for 6 orders, one each, so every order has probability 1/6.

Why a naive shuffle is biased

A common mistake is to go through all places and swap each with a random place from the whole deck, 0 to 51 every time. That looks equally random, but it makes 52 choices at each of 52 steps, so 5252 equally likely sequences. For a bias-free result those would need to split evenly over 52! orders, which needs 52! to divide 5252.

It cannot. For 3 cards the naive loop has 3 × 3 × 3 = 27 sequences and 6 orders, and 27 divided by 6 is 4.5, not a whole number. Some orders must get 4 sequences and others 5. Enumerating the 27 sequences gives three orders at 4/27 (about 14.8%) and three at 5/27 (about 18.5%), against the fair 1/6 (about 16.7%). For 52 cards the same argument applies: 52! contains prime factors such as 47 that 5252 does not, so the split is uneven.

The bias is small per card but it is systematic, and it is the reason testing looks at the algorithm and not only at the output. A shuffle can be unbiased in theory and still fail in code.

Modulo bias in picking a random place

Generators produce a fixed-size integer, for example 32 bits, which holds the values 0 to 4,294,967,295, so 232 = 4,294,967,296 values. To pick a place from 52 the lazy way is to take the value mod 52. But 4,294,967,296 = 52 × 82,595,524 + 48.

So the places 0 to 47 each receive 82,595,525 values and the places 48 to 51 each receive only 82,595,524. The difference is one value in about 82.6 million, which is tiny, but it is a bias and it grows when the range is large against the generator's width. The standard fix is rejection: discard values from the incomplete final block (the last 48 values, here) and draw again. After rejection every place has exactly 82,595,524 values and so the same chance.

Seed size sets a hard limit

A pseudo-random generator is fully determined by its seed. If the seed has 32 bits, there are only 232 = 4,294,967,296 different seeds, so at most that many different shuffles can ever come out, however good the algorithm is.

Compare that with the deck: 13! = 6,227,020,800, already above 4,294,967,296. A 32-bit seed cannot even reach every order of 13 cards. For 52 cards, 2225 is about 5.4 × 1067, which is below 52!, and 2226 is about 1.08 × 1068, which is above it. A generator would therefore need at least 226 bits of state and seed to be able to reach every order.

The seed must also be unpredictable. A seed taken from the clock in seconds is guessable, because there are few plausible values. This is why the seed comes from an entropy source, explained in what entropy means in casino RNG seeding. Standards for random bit generators built on hash functions or block ciphers, such as NIST SP 800-90A Rev. 1, address this kind of generator.

Where a shuffle can go wrong

FaultWhat it doesArithmetic check
Naive swap loopSome orders likelier than othersnn sequences cannot split evenly over n! orders (27 over 6 for 3 cards)
Modulo biasLow places favoured slightly232 = 52 × 82,595,524 + 48
Short seedMost orders can never occur232 seeds against 13! = 6,227,020,800 orders
Guessable seedShuffle can be predictedFew plausible seeds to try
Reusing one shuffle for a long shoeNot a fault if disclosedRules should state when the shoe is reshuffled

What the Kenyan rules say

Regulation 45(2) of the Conduct of Gambling Operations Regulations, 2026 requires the random number generator used for all games of chance to be certified by the Authority or its approved agent to statistically test randomness and theoretical return to player. Regulation 45(3) says game rules are evaluated or certified annually. The text does not name Fisher-Yates or any other shuffle algorithm, so how a given game shuffles is a matter for its rules and its certification report.

The Licensing Regulations list what an independent testing laboratory may offer on Form 11: RNG evaluation and certification, game logic and maths verification, hardware integrity and security testing, payout percentage verification, and network and software security audits. Form 12, for software and platform authorisation, asks for an RNG certificate and the name of the independent testing laboratory, and commits the applicant to notify the Authority of material changes and submit them for re-testing. The guide to RNG testing in Kenya covers these steps.

What a fair shuffle does not change

A correct shuffle makes each deal independent of the last, which is why card counting does not carry over to a game that reshuffles often, as explained in why card counting does not work in online blackjack. It does not make the game cheaper: the edge sits in the rules and payouts. Physical decks follow a different path, described in how live dealer shuffles are verified.

Play responsibly. Gambling is addictive, and for adults aged 18 and over it is a paid pastime, never income. Set a deposit limit and a time limit before a session; the responsible gambling page lists the GRA toll-free line and the self-exclusion process.

Questions and answers

Does online blackjack shuffle after every hand?

That depends on the game design, which the game rules should state. Some software games build a fresh shuffled deck or shoe for every round, and others deal from one shuffled shoe until a cut point. The shuffle method is the same in both cases, and the rules displayed before a wager should say which one applies.

Can a shuffle be fair if the generator is only pseudo-random?

Yes, provided the generator has enough internal state, a seed that cannot be guessed, and a correct shuffle algorithm on top. Each of these can fail separately, which is why a fair-looking result on its own proves little.

Why can't I spot a pattern in the cards that come out?

A fair shuffle produces runs, repeats and clusters as a normal part of randomness. The next card cannot be inferred from earlier ones in a single shuffle that is done correctly, and the hidden generator state is not visible to the player.

What does Kenyan regulation say about the shuffle itself?

Regulation 45(2) of the 2026 Conduct of Gambling Operations Regulations says the random number generator used for all games of chance must be certified by the Authority or its approved agent to statistically test randomness and theoretical return to player. The text read for this guide does not name the Fisher-Yates method or any other shuffle algorithm.

Does a fair shuffle change the house edge?

No. The shuffle only decides the order of the cards. The house edge comes from the rules and the pay table, such as the blackjack payout and the dealer's drawing rule.

Sources

  1. Gambling Control (Conduct of Gambling Operations) Regulations, 2026 (L.N. 112), regulation 45, accessed 2026-11-19
  2. Gambling Control (Licensing) Regulations, 2026 (L.N. 111), Form 11 Section C and Form 12 Section C, accessed 2026-11-19
  3. NIST SP 800-90A Rev. 1, Recommendation for Random Number Generation Using Deterministic Random Bit Generators, accessed 2026-11-19