PokéBase - Pokémon Q&A
4 votes
8,447 views

Also known as RNG abuse. How does it work and what does it do?

by

1 Answer

10 votes
 
Best answer

Let's answer this question in two parts. Firstly...

What is RNG?

Computers need some way to make decisions -- for example, choosing what Pokemon you will encounter when you run in tall grass, or what that Pokemon's stats will be. To make that choice, computers can use random numbers. For example, if there are 25 natures, then the computer might pick a random number between 1 and 25 to choose what nature your wild encounter will have.

A random number generator (RNG) is what we use to create random numbers. In practice, a RNG is usually some algorithm written in computer code that transforms an input number to an output number, where the output number should have little/no relation to the input number (i.e. the output is random). There are many kinds of RNGs that each differ in performance, complexity, security, and of course: statistical randomness.

We say "statistical randomness" because computers cannot truly be random -- only pass tests of empirical randomness. For this reason, most consider the term pseudo-random number generator (PRNG) to be correct. The "best" PRNGs are functionally impossible to predict and are safe to use in cryptography, etc.

What is RNG manipulation?

Though Pokemon has modernised its approach to RNG in recent times, it has historically used simple PRNGs that are very easy to predict. This gives rise to RNG manipulation, where we massage the game into giving us favourable outcomes (e.g. Shiny, 6 IV, the nature we want, etc) using our knowledge of the RNG it uses, and what it actually does with the generated numbers.

Using Gen 3 to 5 as a reference point, Pokemon makes heavy use of a type of PRNG called a linear congruential generator (LCG), which is very simple despite its name. It takes an input number (the seed), then does some addition and multiplication to get an output number, and then remembers that output number (the state) to use as the seed next time we want a random number.

So a loop is created, like this:

image

How many times we cycle the state is called the frame (or simply the number of "advances"). For example, if we start with 24983 as the initial seed, then run the algorithm 10 times and end up with the number 75864, then 75864 is on the 10th frame for the seed 24983.

Since the state feeds directly back into the next seed, this RNG unravels completely if you know the initial seed. What's the initial seed? Usually, it's just the date and time of your console when you boot the game! (Using Gen 4 and 5 as a reference point)

We can abuse this easily. Say we know the number 75864 (from the example above) will cause us to get a shiny. All we need to do is set the date/time of our game to match 24983 (in computer terms), then cycle the state nine times to get our number. If we then trigger an encounter (thereby consuming the tenth frame), we'd get a shiny!

So, how do we use all of this?

Thanks to extensive research, we know all about the game's RNG, when/how the game advances the frame, and what it does with the numbers it creates. People have written programs (chiefly, PokeFinder) that let you pick the exact traits you want, then go search for a seed + frame that will give you those traits.

These programs, plus a bit of patience, can get you a 6 IV Ditto and let you complete breeding projects that are prohibitively difficult without.

image
Screenshot of PokeFinder: A filtered list of seeds + frames that can yield 6 IV Ditto encounters on Route 47 in HG/SS.

In practice, the procedure for RNG manipulation goes roughly as follows (again, Gen 3-5 as a reference):

  1. Preparations in-game, such as progressing to the required part of the story, catching parents for breeding, or finding your Secret ID (SID), which is required to do RNG manip for shinys.
  2. Using PokeFinder or a similar program to fill in your TID/SID, then type in the traits you want (ex: Shiny + Adamant nature + ability slot 2), then search for a seed + frame that gives those traits. If you're searching for something exceptionally rare (ex: Shiny + specific IV combination), there might be few results or none at all. PokeFinder is usually configured to skip results that require millions of frame advances; you can extend the maximum number of advances if you're really desperate, but that usually means waiting a long time.
  3. Attempting to hit the target seed + frame you saw in PokeFinder! This often involves setting the date/time in your console, then using EonTimer to pull off a "frame perfect trick"; that is, you load the game or press A on the title screen with flawless timing. This looks daunting at first, but 60 FPS isn't actually too hard to get right.
  4. In your game, confirm whether or not you hit the correct seed (and potentially the correct frame as well). This could mean anything from flipping coins with the Poketch and seeing if they match up, to outright triggering your encounter and using a stat calculator to confirm if the Pokemon has the IVs you wanted. If you didn't hit your seed, you can usually figure out what seed you actually hit, and re-calibrate EonTimer based on that.
  5. Keep resetting and doing step 3-4 until you hit your seed + frame. When you do, that's it! Trigger the encounter. The Pokemon you saw in PokeFinder will be yours in-game.
  6. Every game has little nuances and potential pitfalls to be aware of, so it helps a lot to watch a video demonstration of what you're trying to do. There are heaps on YouTube.

Below are resources with specific info if you want to get started. Gens 3-5 are the closest application of the information in this answer about LCGs, while Gen 7 is generally considered the easiest to get results in. RNG manip is mostly dead as of Gen 9, as Pokemon has stopped using global state RNG (i.e. instead of tracking state, it dynamically re-seeds the RNG using hardware parameters, so we can't "unwind" it like the simple LCGs in old games).

by
selected by