Your game's random number generator isn't broken — it's deterministic by design. Here's what seeding actually does, why identical seeds produce identical runs, and why that matters when a roguelike gives you the same cursed floor twice.

You're forty minutes into a run. Critical hit lands. You dodge the next three attacks. The item drop is perfect. Then the game crashes — and when you reload, the exact same sequence of "random" events plays out again. Same hit, same dodge, same drop, in the same order. That's not a glitch. That's seeding, and once you understand it, you'll stop blaming the RNG and start using it.

Pseudo-random number generators — PRNGs — are what every game engine uses. They're not random. They're deterministic functions that look random. Feed one a starting number (the seed), and it produces an infinite sequence of outputs that passes statistical randomness tests. Feed it the same seed again, and it produces the same sequence. Every time. No exceptions.

1. What a seed actually is

A seed is just a number — usually a 32- or 64-bit integer. The PRNG takes that number and runs it through a mathematical transform to produce the next number, then transforms that to produce the one after, and so on. The Mersenne Twister (MT19937), which Python's random module and many game engines have used as their default, maintains 624 32-bit words of internal state. Every output you pull from it advances that state.

Where does the seed come from? Usually the system clock at startup — something like time(NULL) in C, measured in milliseconds or microseconds. That's why two runs started at different times feel independent. But start them at the same millisecond (easy to do in a test harness, or via a game's "practice seed" feature) and you get identical results. This is the entire basis of speedrun seed manipulation: enter the run at a specific clock tick and the item drops are predetermined.

2. Why "random" streaks happen

The streak problem — five misses in a row, an item drought for ten minutes, a run where the boss crits six times — isn't the RNG failing. It's exactly what a flat distribution produces. A 30% hit chance means one in three attempts lands on average, not that every third swing hits. Real streaks of five misses (0.7^5 ≈ 17%) aren't rare at all. You'll see them in maybe one in six combat bursts.

The emotional weight of a streak is what distorts perception. Three crits in a row feel significant. Three misses feel unfair. They're symmetric events with symmetric probabilities, but the human nervous system doesn't treat them symmetrically. The PRNG has no memory — each call is independent of the last — but players experience the cumulative string and read intent into it.

Some designers explicitly break the flat distribution to fight this perception problem. Warcraft III introduced the "pseudo-random distribution" (PRD) system: a 25% crit chance starts each combat at roughly 5–6% actual probability and rises by ~5% per non-crit until a crit fires, then resets. The real crit rate stays 25% over long sequences, but streaks — in either direction — are suppressed. The RNG is rigged. On purpose.

3. Seed-based world generation

Minecraft's world generator is the canonical example. Every block placement, cave system, biome edge, and dungeon position is a deterministic function of the world seed. Enter seed -4172144997902289642 and you get the same mesa biome 300 blocks east every single time, on every machine running the same version. The world isn't stored — it's recalculated from the seed on demand.

This has two implications. First, a known seed is a map: the entire world is knowable before you touch it, which is why seed-sharing sites exist and why speedrunners search for seeds with a stronghold close to spawn. Second, updating the PRNG algorithm or the generation logic between game versions will produce a completely different world from the same seed — which is exactly why Minecraft's "Java Edition vs Bedrock Edition" seeds diverge.

Roguelikes use the same principle. Dead Cells, Hades, Spelunky — each run is seeded at start. The seed determines room order, enemy placement, item drops, everything. This is how daily challenges work: everyone gets the same seed, so everyone faces the same run, making scores comparable despite the "random" content.

"A pseudorandom number generator (PRNG) ... is an algorithm for generating a sequence of numbers whose properties approximate the properties of sequences of random numbers. The sequence is not truly random in that it is completely determined by an initial value, called the PRNG's seed."

Wikipedia, "Pseudorandom number generator" (CC BY-SA 4.0)

4. When seeding goes wrong

Predictable seeds are a security problem in contexts that matter. Online card games that seed their shuffler with the current timestamp (seconds precision) have been exploited: an attacker who knows the approximate game-start time can enumerate the handful of possible seeds and reconstruct the deck order. This exact attack worked against early online poker rooms in the late 1990s and early 2000s. The fix is a cryptographically secure RNG (/dev/urandom, crypto.getRandomValues()) seeded with enough entropy that the seed space is unsearchable.

For single-player games this doesn't matter — predictability is a feature, not a bug. For anything competitive or gambling-adjacent, a weak seed is a real vulnerability. The distinction between "PRNG for gameplay feel" and "CSPRNG for anything with money on it" is the line most studios draw.

5. Consuming the sequence: order matters

Here's a subtle one. Two systems sharing the same RNG stream — say, enemy AI and loot drops both pulling from one global PRNG — will interfere with each other when the number of AI decisions changes. One more enemy action in a fight means the loot pull comes from a different position in the sequence. This is why well-engineered games use separate seeded generators per system: one for combat, one for drops, one for world generation. Isolation prevents a change to the AI from accidentally shuffling the economy.

It's also the mechanism behind a class of save-scumming exploit: load a save before a critical RNG check, perform some action that advances the global sequence (open an unrelated menu, move a step, trigger an irrelevant event), then trigger the check from a different position in the stream. If the check is seeded globally, it now resolves differently. Speedrunners call this "RNG manipulation" and it's entirely valid — the game's seed is public information to anyone who can observe its outputs.

The practical takeaway

Your game's RNG isn't broken and it isn't cursed. It's a function — a very long, very complicated one — applied to a starting number. The streaks you feel are real; the intent behind them isn't. If you want to explore the actual distribution your rolls are pulling from, our dice roller handles arbitrary notation and shows how flat a single die really is versus a pool. The damage calculator is useful when you're trying to work out what consistent DPR looks like across a run, and the XP curve calculator helps model the pacing implications when variance in combat length ripples forward into progression speed.

← All articles