Tetris Randomizers Explained: 7-Bag, TGM History Rolls, and Why NES Owed You Nothing
Every version of Tetris answers the same question differently: what comes next? The answer ranges from a shuffled bag with hard mathematical guarantees to a single polite reroll that owes you nothing, and knowing which one you are playing against changes how you stack.

Look at the hero image on this post for a second. It is a long NES Tetris run, and the statistics panel is quietly telling you everything about why classic Tetris feels the way it does. Across 3,313 pieces dealt, that player received 576 I pieces and 410 Z pieces. That is a 40 percent surplus of long bars over one shape of snake, produced by nothing but dice. No modern Tetris game will ever hand you a spread like that, and the reason is the single most important piece of design most players never think about: the randomizer.
Every Tetris game has to answer one question every couple of seconds — what comes next? — and different eras answered it in genuinely different ways. The answer decides how bad droughts can get, whether back-to-back S and Z pieces can wreck a flat board, whether openers exist, and whether the game can theoretically be played forever. This is a tour of the machines behind the next queue, with the actual numbers.
The bag is why modern Tetris feels fair
Modern Tetris-branded games use an algorithm the Tetris Guideline calls the Random Generator, and everyone else calls 7-bag. The name sounds generic, but it is treated as a proper noun — it refers to one specific algorithm, not to random generation in general.
The concept fits in a sentence: put all seven tetrominoes in a bag, shuffle, deal them out one at a time, and when the bag is empty, refill and reshuffle. Every group of seven consecutive pieces from a bag boundary contains exactly one of each piece. There are 7 factorial — 5,040 — possible orders for a single bag, and the game deals each of them with close to equal probability.
That one design choice is doing enormous, invisible work. Your stacking fundamentals rely on it: 9-0 stacking with a right well is only safe because the bag promises an I piece on a schedule. The perfect clear opener only has its famous success rates because the first fourteen pieces have a known composition. Openers as a concept — memorized setups built on the first bag or two — exist because 5,040 starting orders is a small enough space to plan against. In a truly random game that number would be effectively infinite.
The bag was not born with the Guideline, either. The Random Generator was originally developed for The New Tetris on the N64, and that early version used a comically large bag of 63 pieces — nine of each — so that streaks could still happen and square-builders would not starve waiting for specific pieces. The tight 7-piece version became the standard in Tetris-branded games from the early 2000s onward. A few oddballs persist: the public beta of Tetris Online (Japan) ran an 8-bag, and TGM3 keeps its own randomizer even when running Guideline-style World Rule, which we will get to.
How 7-bag actually works
You can watch the bag work in any game with a decent preview count. Here is Tetris DS, which shows six previews plus hold:

Count what is visible: an I in the hold box, then I, J, Z, S, O, L in the queue. Six previews plus the active piece means you are looking at essentially a full bag of information at all times. Once you know the dealing rule, that queue stops being a list of pieces and becomes a countdown — if you have seen six different pieces since the last bag boundary, you know exactly what the seventh must be before it appears.
Reading bag boundaries is a real skill with a simple training method: every time you see a duplicate piece in the queue, that duplicate belongs to the next bag, so the boundary sits somewhere between it and the previous copy. Track that seam for a few games and piece counting becomes automatic. It also tells you when a memorized opener is still on the table: as our Sprint guide points out, a specific opener only matches a small slice of those 5,040 first-bag orders, so recognizing early which order you actually got is worth more than knowing one setup deeply.
Randomizer nerds even built a notation for describing these machines — a mini-language called Blackjack, in which the Guideline randomizer is written as "bag of I,J,L,O,S,T,Z" and the TGM randomizer gets a one-liner involving history and rolls. The fact that the community needed a formal language to compare randomizers tells you how many of these designs exist.
What the bag guarantees and what it does not
The guarantees are hard, mathematical, and worth memorizing:
- You will never wait more than 12 pieces between I pieces. Worst case: the I is dealt first in one bag and last in the next — six non-I pieces close out bag one, six more open bag two. There is no thirteenth.
- You can never receive more than four S and Z pieces in a row. Each bag carries exactly one S and one Z, so any snake run longer than two has to straddle a bag seam, and four is the ceiling.
- In any 14 consecutive pieces you get exactly two of everything if they align to bag boundaries — the composition is fixed even when the order is not.

What the bag does not guarantee is comfort inside those bounds. A 12-piece I drought is rare but legal, and it will happen to you. Order within a bag is unconstrained, so the bag can front-load garbage — Z, S, Z, S across a seam onto a flat board is fully licensed by the rules. The bag makes Tetris plannable, not kind.
One more subtlety: the guarantees are about bags, not about any arbitrary window. Seven consecutive pieces that straddle a seam can contain two I pieces and zero T pieces. If you count from the wrong anchor, the bag will look like it is lying to you. It is not — you are just reading across a shuffle boundary.
The snake math: how bad can S and Z get
The wiki community has done the exact probability work on worst-case snake sequences, and the numbers are worth knowing because they calibrate how scared you should actually be of a flat board.
- A run of three consecutive snake pieces has a probability of 1 in 257 at any given point in the queue.
- Any given pair of adjacent bags has just a 1 in 441 chance of containing the maximum four-snake run at all.
- The chance that the next four pieces specifically are S, Z, S, Z is 1 in 3,087.
So the nightmare scenario — alternating snakes forcing overhang after overhang — is real but rare enough that building for it constantly is a mistake. The correct amount of S/Z paranoia under 7-bag is roughly one prepared spot: keep one step or notch somewhere on your surface where a snake lands flush. Two of every seven pieces are snakes on average, and the bag will never ambush you with more than four. Compare that to the classic randomizers below, where five consecutive S pieces is merely unlikely, and you start to see how much modern stacking style is downstream of the randomizer.
NES: one polite reroll, no promises
NES Tetris (1989) does something much simpler, and the simplicity is the difficulty. When it needs a new piece, it rolls a value from 0 to 7 — eight outcomes for seven pieces plus a dummy slot. If the roll is anything other than the previous piece or the dummy value, that piece is dealt on the spot. If the roll fails — it hit the repeat or the dummy — the game rolls once more, this time from 0 to 6, and deals whatever comes up, even if it is a repeat.
Run the arithmetic on that algorithm and you get a picture of exactly how much protection it buys. A back-to-back repeat needs the first roll to fail (2 chances in 8) and the second roll to hit the same piece again (1 in 7), which works out to 1 in 28 — down from 1 in 7 on pure dice, so direct repeats are cut to a quarter of their natural rate. That is the entire safety net. There is no memory beyond one piece, no bag, no cap on anything.
Droughts follow directly. Under this scheme the chance that the next twelve pieces contain no I — a gap that is literally impossible to exceed in 7-bag — is about 12 percent, and the chance of a 20-piece I drought is about 3 percent. Over a long NTSC run you will eat multi-bag-length droughts repeatedly, which is why classic players build shallower and take singles and doubles their modern instincts would refuse, and why the statistics panel in the hero image can show 576 I pieces against 410 Z pieces over one game. The variance runs both directions — that player was I-rich and snake-poor, and the next run might invert it.

The deeper NES rabbit hole — the shift-register RNG and its measurable bias against long bars — is covered in our NES DAS, hypertapping and rolling guide. The short version for this article: not only is the NES randomizer uncapped, it is not even perfectly uniform.
TGM: a bouncer with a four-name list
Arika's Tetris The Grand Master series went a third direction: history rolls. The game keeps a list of the four most recently dealt pieces. When it needs a new one, it rolls, checks the roll against the history, and if the piece is a recent repeat, it rolls again — up to 4 attempts in TGM1 and 6 attempts in TGM2 and its Absolute/TAP revision. If every attempt lands on something recent, the game shrugs and deals the repeat anyway, which happens about 3.5 percent of the time under the six-roll version.
Two lovely details live in the initialization. TGM1 starts the history pre-loaded as Z, Z, Z, Z — four phantom Z pieces — which biases the opening deals away from snakes. TGM2 seeds it as Z, Z, S, S for the same effect. And the first real piece of a game is never S, Z, or O at all, because each of those as an opener forces an overhang or a split flat that the developers decided you should not have to eat on piece one. Even TGM Ace and TGM4, which adopt the Guideline 7-bag for compliance, modify it so the first piece is always I, J, L, or T.
Notice what history rolls protect against and what they do not. Repeats and floods — four S pieces in a row — become vanishingly rare. But there is no drought protection whatsoever: the history only remembers four pieces, so a piece that simply stops showing up is invisible to the algorithm. TGM1 and TAP droughts can run brutally long, and drought reading — stacking for the I you are not being given — is a core skill in those games, right alongside surviving the 20G gravity they are famous for.
TGM3 fixed droughts with a 35-piece pool
TGM3 Terror-Instinct kept the history system and bolted a drought-killer onto it. Instead of rolling uniformly across seven pieces, the game draws from a pool of 35 — five copies of each piece. Here is the clever part: when a piece is drawn, the pool slot is not left empty and is not refilled with a copy of what was drawn. It is refilled with a copy of the most drought-starved piece — the one dealt least recently.
The effect compounds. Every deal that is not, say, an I makes the pool slightly more I-rich, so the odds of the drought continuing shrink with every piece. At the extreme, it becomes impossible for any piece to be absent for longer than a 35-piece sequence — a hard cap, like the bag has, just wider. Floods are still suppressed by the history check on top. The community's disassembly work found the implementation carries some subtle bugs, but the design intent is clear and elegant: bag-style drought protection without bag-style predictability. You cannot count a 35-pool the way you count a 7-bag, so TGM3 keeps the classic feel of an unknowable queue while quietly refusing to starve you.
It says something that Arika trusted this system enough to run it even in World Rule modes, where everything else about the game bends toward the Guideline. The randomizer was apparently the hill worth keeping.
Playing forever is a real documented strategy
Here is the punchline to all of this: 7-bag is so predictable that, under the right conditions, Tetris stops being survivable and becomes solved. The community has documented a complete method for playing forever — not metaphorically, but a literal infinite loop — that works in most Guideline games. It needs three things: the Random Generator, a hold slot, and at least three previews.

The method splits the field into three territories: S, T and Z pieces are placed exclusively in the left four columns, L, J and O exclusively in the right four, and every I piece drops into the middle two. Because every bag delivers exactly one of each piece, each territory receives a fixed, predictable diet — and each side runs a looping pattern that returns to its starting shape. The S/T/Z pattern on the left repeats every four bags; the L/J/O pattern on the right repeats every single bag. Hold irons out the order within each bag, with five previews making the right-side pattern choice trivial and three sufficing with some documented advanced contortions.
Whether you find that beautiful or damning depends on taste — it was a real argument in the community for years. The bag's defenders point out that no human plays the loop under pressure and that fairness makes the versus game deeper, not shallower. The purists point at exactly this diagram and say a randomizer you can tile against forever is not random in any meaningful sense. Both are right, which is presumably why Arika never adopted the bag for its own modes and why classic NES competition never died.
How to use this in actual games
- In any Guideline game, count against bag seams. Spot a duplicate in the queue, mark the boundary, and you will know what is owed before it appears. The queue is a ledger, not a lottery.
- Cap your I-piece anxiety at 12. Never build taller waiting for a bar than a 12-piece drought justifies. If your well discipline survives 12 pieces, it survives anything 7-bag can deal.
- Keep exactly one snake-friendly spot on your surface. More is waste — four in a row is the absolute worst case and it arrives about once per 441 bag-pairs.
- In NES, respect the void. No cap on droughts, only a 1-in-28 shield against repeats. Build for the I you might not get for 20 pieces, and bank singles without shame.
- In TGM1 and TAP, fear droughts, not floods. The history roll makes repeats rare; it does nothing about absences. In TGM3, relax — nothing can hide for more than 35 pieces.
- Learn one opener, then learn to recognize when it is dead. With 5,040 first-bag orders, adaptation beats memorization everywhere below the elite level.
More Tetris breakdowns live on the Tetris coverage hub.
Quick Action Checklist
- Modern Tetris uses the Random Generator: all seven pieces shuffled in a bag, dealt, refilled. 5,040 possible orders per bag.
- Hard guarantees: at most 12 pieces between I pieces, at most 4 snakes in a row, fixed composition per bag.
- Snake odds: three snakes in a row is 1 in 257; a pair of bags containing the max four-snake run is 1 in 441.
- The bag debuted conceptually in The New Tetris as a 63-piece bag, nine of each, before the 7-piece version became standard.
- NES rolls 0-7, rejects only the previous piece and a dummy value, then rerolls 0-6 and accepts anything — repeats hit at 1 in 28, droughts have no cap.
- TGM keeps a 4-piece history with 4 rolls (TGM1) or 6 rolls (TGM2/TAP); a recent piece still slips through about 3.5 percent of the time.
- TGM never opens a game with S, Z or O; TGM1 seeds its history with four phantom Z pieces.
- TGM3 draws from a 35-piece pool that refills with the most-starved piece, capping any drought at 35.
- With 7-bag, hold and 3+ previews, a documented method exists to play forever: S/T/Z left, L/J/O right, I in the middle.
- Count bag seams via duplicates in the queue — it is the cheapest information upgrade in modern Tetris.
Frequently Asked Questions
Keep Reading
- TetrisWiki — Random Generator: 7-bag mechanics, drought and snake-run limits, bag-size variants and history
- TetrisWiki — TGM randomizer: history rolls in TGM1/TGM2/TAP, first-piece rules, and the TGM3 35-piece pool
- TetrisWiki — Tetris (NES): reroll randomizer behaviour and game mechanics
- TetrisWiki — Playing forever: the S/T/Z, L/J/O and I region method and its loop lengths
- TetrisWiki — Blackjack: a notation language for specifying Tetris randomizers
Related Guides

Tetris Stacking Fundamentals: Build a Board That Wins
Most players do not lose to speed. They lose to a board they built themselves three minutes earlier. Here is how stacking actually works in modern Guideline Tetris, and the habits that stop you from burying your own well.

Tetris Gravity and Lock Delay Explained: The Speed Curve, the 15-Move Limit, and 20G
Every modern Tetris game runs on three clocks you never see: gravity, lock delay, and entry delay. All three are published numbers, and they explain exactly why level 15 feels like a different game than level 5.

Tetris 99 Strategy Guide: Badges, Targeting, and Winning the 99
Tetris 99 is not a speed contest with 98 strangers. It is an economy — badges are the currency, targeting is the market, and the players who win are the ones who understand both while everyone else just stacks. Here is how the mode actually works.

Tetris Wall Kicks Explained: SRS Kick Tables, ARS, and NES
Your I piece did not glitch. It jumped two columns left because test 2 of its kick table says to, and the game ran that test before it ran the one you wanted. Here is what every modern Tetris is actually checking when you press rotate.

NES Tetris DAS, Hypertapping and Rolling: How the Kill Screen Died
NES Tetris moves your piece sideways ten times a second. At level 29 a piece falls the whole well in twenty frames. That gap is why hypertapping and rolling exist, and why the kill screen is not a kill screen anymore.

The Tetris Perfect Clear Guide: PCO Openers and Setups
The Perfect Clear Opener wipes your board in ten pieces and dumps 7 garbage rows on your opponent before they have a well. It succeeds nearly two thirds of the time blind, and 84.64% if you hold the I. Here is how it is built.