Random number generator
- "RNG" redirects here; for the stat abbreviated as "Rng", see range.
|This page has been marked as a stub. Please help improve the page by adding information.|
The random number generator (or RNG) is a system that randomly generates numbers. Randomness is present in almost every game in the Fire Emblem series, primarily in the results of combat. As with most computer systems, random numbers in Fire Emblem are not truly random but pseudorandom—they simulate randomness with a deterministic series of numbers. When and how random numbers are generated changes from game to game.
In the first three games, random numbers are "burned", and change each frame; they are saved as an eight-bit integer (ranging 0–255) that increments by 55 each time it is used, including when it is burned. in Fire Emblem: Shadow Dragon & the Blade of Light, the eight-bit integer is multiplied by 10 then divided by 25 (× 10 / 25) and then truncated—this allows for numbers ranging from 0 to 102, but all numbers above 100 are reduced to it; in Gaiden and Mystery of the Emblem, the integer is multiplied by 100 and divided by 256 (× 100 / 256) then truncated, allowing for a range of 0–99.
In most games from Genealogy of the Holy War onward—including the Game Boy Advance games and the games with turn-rewind mechanics—random numbers only change once they are used. The GBA games use similar RNG to each other: random numbers are stored as a sixteen-bit integer (ranging 0–65535) that is divided and truncated; in The Binding Blade, the integer is divided by 655, allowing for numbers 0 to 100—in The Blazing Blade and The Sacred Stones, the integer is multiplied by 100 and divided by 65536 (× 100 / 65536), allowing for numbers 0 to 99.
In most cases, only a single random number is used to determine the outcome of a random event. However, in games the use true hit—The Binding Blade being the first of which—two random numbers are used to determine whether an attack hits.