Skip to main content

How RNG Works in Slot Games: From Random Number to Reel Stop

· 12 min read

How RNG works in slot games

A slot's random number generator (RNG) does one small job. On every spin it picks a number, and the game turns that number into a position on each reel. Everything players care about, such as how often they win and how big the wins are, comes from what sits on the reels and in the paytable. The RNG only makes sure nobody can predict or steer which position comes up.

This guide follows one spin from the random number to the symbols on screen. It uses a small 5-reel game as the example, then shows how our own RNG service is built, how we test it, and what certification labs look for.

What an RNG is in a slot game​

An RNG is a piece of code that returns numbers with no pattern anyone can use. Online slots use a pseudo-random number generator (PRNG). A PRNG is an algorithm, so its output is fixed once you know its internal state, called the seed. What makes it safe is that the seed comes from a secure source of entropy and never leaves the server.

Two kinds of generator show up in slot code:

  • The operating system's secure generator. Calls such as crypto/rand in Go or crypto.randomInt in Node.js draw on the operating system's entropy every time. Nobody, including the studio, can reproduce a result afterwards.
  • A fast seeded generator. Algorithms such as xoshiro256** or ISAAC produce a long stream of numbers from one seed. Seeded from secure entropy and kept on the server, they are just as unpredictable to players, and they have one big advantage: with the seed and a record of which draws were used, any spin can be replayed exactly for an audit.

Either way, the RNG runs on the game server, never in the player's browser. The browser only receives the result and plays the animation.

One spin, step by step​

Here is what happens when a player presses spin on a typical 5-reel, 3-row video slot.

  1. The server receives the bet. The client sends the stake, and the server checks the balance before anything is drawn.
  2. The RNG picks one stop per reel. Each reel has a strip, a list of symbols in a fixed order. For each reel the server draws a whole number from 0 up to the strip length minus one. That number is the reel stop.
  3. The stops become a grid. The symbol at the stop, plus the next two on the strip, fill that reel's three visible rows.
  4. The grid is checked against the paylines and paytable. The server adds up every winning line and any feature triggers.
  5. The result goes back to the client. The client gets the grid, the wins and the new balance, then plays the reel animation to land on that grid.

The reels on screen do not decide anything. By the time they start spinning, the result already exists.

In Go, the drawing step for one reel is only a few lines:

func spinReel(strip []int) int {
n, _ := rand.Int(rand.Reader, big.NewInt(int64(len(strip))))
return int(n.Int64()) // the reel stop
}

The RNG treats every stop the same. Each of the 32 positions on a 32-stop strip has exactly a 1 in 32 chance.

Turning a random number into a fair reel stop​

Step 2 hides a trap. A generator gives out raw numbers over a fixed range, for example 0 to 255 for one byte, or 0 to 2^64 − 1 for a 64-bit word. The game needs a number in a much smaller range, such as 0 to 49 for a 50-stop reel.

The obvious shortcut is the remainder: take the raw number and divide by 50. With one byte, that is unfair. 256 does not divide evenly by 50, so remainders 0 to 5 come up 6 times in 256 while every other stop comes up 5 times. The first six stops on the reel would land 20% more often than the rest, and the game's real RTP would drift from the one in the design.

Our RNG uses Lemire's method instead. It multiplies the 64-bit random number by the range, keeps the top half of the result as the stop, and throws away the rare draws that fall in the uneven tail, then draws again. Every stop comes out exactly equally likely, and almost no draws are wasted. Certification labs check for exactly this, which is why the mapping is written up in the RNG design document alongside the algorithm.

Reel strips set the odds, not the RNG​

If every stop is equally likely, how does a game make some symbols rare? The answer is how many times each symbol is placed on the strip. This is called weighting.

Here is the first reel of a small 32-stop test game:

SymbolTimes on the stripChance per spin on this reel
Wild13.1%
Diamond13.1%
Seven13.1%
Bar39.4%
Bell515.6%
Cherry721.9%
Lemon721.9%
Orange721.9%

The RNG is completely fair to every position, yet a Wild lands on the middle row of this reel only about once in 32 spins. A Cherry lands there about once in 4.6 spins. Five Wilds on the middle line need that 1 in 32 chance on every reel, which works out to 1 in 33,554,432 spins.

This is where the game's character comes from. Studios change the strips and the paytable together to reach a target return to player (RTP) and volatility. The RNG never changes. That is also why "the game is due a win" is a myth: the strips do not remember the last spin, and each draw starts fresh.

Some games use virtual reels. The strip in the math has far more stops than the artwork shows, and the game maps each long-strip stop to a picture. The principle is the same: the RNG picks a stop, and the strip decides what it is worth.

How our RNG service works​

We run our own RNG service for the slot and instant games we build. These are the decisions in its design document, and why each one matters.

  • Algorithm. The default is xoshiro256**, a public-domain 64-bit generator with well-studied statistics. A second mode uses the operating system's secure generator directly. We have also built a version on ISAAC, a cryptographic generator with a large internal state, as a separate microservice that games call over gRPC.
  • One seed per player session. Each session gets its own 32-byte seed from operating-system entropy, expanded with SplitMix64. Players never share a stream, so one player's spins say nothing about another's.
  • Regular reseeding. A central timer mixes fresh entropy into every session's generator, every 60 minutes by default and anywhere from 30 to 120. Even someone who somehow learned a state would lose it at the next reseed.
  • Health checks. Every 10 minutes the service tests a megabyte of fresh output. The share of 1 bits must sit between 49% and 51%. If it fails, every session is reseeded, the instance is rotated if the problem persists, and an incident is filed with the data.
  • A record for every spin. Each spin stores the session seed, the first and last draw it used, the build commit, and the debit, result and credit. If a player disputes a spin, we rerun the same build with the same seed and get the identical result, draw by draw.

How we test RNG behaviour before launch​

We test in two layers: the RNG on its own, then the game built on top of it.

For the RNG, a harness writes out large files of raw output, starting at 10 MB, plus files already mapped to game ranges such as 0 to 49. We run those through Dieharder, a standard battery of randomness tests, and keep the reports with the build. Checking the mapped files matters as much as the raw ones, because that is where a biased mapping would show up.

For the game, a correct RNG can still sit inside a wrong game. A strip typed with one symbol out of place, or a payline read off the wrong row, changes the RTP without anyone noticing in a few hundred test spins. So our simulation farm runs the game's math millions of times across many machines. The game exposes one function, runSpin(seed, bet), that plays a single spin from a given seed, so any odd result can be replayed and traced through the reels and paytable.

From those runs we check:

  • RTP against the target, with a confidence range that narrows as the spin count grows.
  • Hit frequency, meaning how often a spin pays anything at all.
  • Win distribution, meaning how often wins of 1x, 10x, 100x and above happen, which is what players feel as volatility.
  • Feature frequency, such as how often free spins trigger and what they pay on average.
  • Maximum win and whether the game caps it correctly.

Only when the simulated numbers match the design do we hand the build over for certification.

What certification labs check​

Independent labs such as GLI, BMM, iTech Labs and eCOGRA test the RNG and the game separately.

For the RNG, the lab reviews the source code, the seeding and the range mapping. It then runs its own statistical tests on large samples of output, both raw and mapped to game ranges, to confirm the numbers are evenly spread and independent. It also checks that nothing on the client side can influence a result, and it records hashes of the critical files so the certified build can be recognised later.

For the game, the lab checks that the math matches the documented RTP, that the paytable and rules shown to players are accurate, and that every outcome the strips allow is reachable and paid correctly.

A certified game carries a fixed version. If a studio later changes the strips, the paytable or the RNG files, the hashes no longer match and the game has to be tested again. That is one more reason the RNG cannot be quietly "tuned" after launch.

Provably fair games​

Some crypto casinos use a different approach called provably fair. The server commits to a secret seed by publishing its hash before play. The player adds their own seed, and each result is calculated from both seeds plus a counter. After the session the server reveals its seed, and the player can recompute every result. It answers the same question as certification, which is whether the house could change an outcome, with a check the player can run themselves.

Common myths, answered with the math​

  • "It hasn't paid for a while, so a win is coming." Each spin draws a fresh stop. The strips and the RNG have no memory.
  • "The casino can switch the RNG to tight mode." In a certified game, the RTP comes from the strips and paytable in a tested version. Changing them means a new version and a new certification.
  • "Night time or weekends pay better." The draw does not use the time of day, and the odds are the same on every spin.
  • "Stopping the reels early changes the result." The result exists before the animation starts. Stopping early only skips the animation.

Building a slot with a certified RNG​

If you are planning a slot, the RNG is the part that has to be right first time: the algorithm, the seeding, the mapping and the audit trail all go in front of the lab. After that, the work is in the reel strips, the paytable and features that hit a target RTP and volatility, and the testing that proves it. Our slot math and simulation service covers RTP, volatility, hit frequency and outcome testing before integration. For the full build, see our slot game development services, or send your game brief with the target platform, features and math requirements.

FAQs About RNG in Slot Games​

What is an RNG in slot games?

It is the code on the game server that picks a random number for each reel on every spin. The number becomes a stop on that reel's strip, and the symbols around the stop are what the player sees.

Does the RNG decide how often a slot pays?

No. The RNG gives every reel stop the same chance. How often each symbol appears depends on how many times it is placed on the reel strip, and the payouts come from the paytable. Together those set the RTP and volatility.

Are slot results affected by past spins or the time of day?

No. Each spin draws new reel stops, and the strips have no memory. The odds are the same on every spin, at any time.

What is the difference between RNG, RTP and volatility?

The RNG picks each outcome at random. RTP is the share of all bets the game pays back over a very large number of spins. Volatility describes how those payouts are spread, from frequent small wins to rare large ones.

How is a slot's RNG tested?

Studios run the game math millions of times to confirm RTP, hit frequency and win distribution. Independent labs such as GLI, BMM, iTech Labs and eCOGRA then review the RNG code and seeding, run statistical tests on its output and check the game math before it can launch.