The RNG outputs a series of numbers between 0-4294967296. Not sequentially, but in a known pattern, with no numbers repeated. In Emerald each time the game is reset/restarted the numbers being generated begin at a known point, called a "seed", and progress at a farily steady rate of 60 per second. This lets us know, at a certain time after a reset, what number the RNG is going to produce. If you've seen the frame spreadsheets or the output of emloop this should make sense.

To clarify, think of exploiting the RNG in Emerald in the terms of taking a trip.

With a fixed starting point (seed), route (frame listing), and speed (60 frames per second) it is easy to tell where you are going to be after a certain point in time.

Emerald always starts from the same location, and this is the magic behind all of the wonderful things that people are resetting and breeding. The other games all travel the same route, but they mix things up by starting you at a different location on the route each time the game is reset. Since your location at start is not known it is not possible to know where you are after any given time.

This thread documents how get our starting location (seed) and how to determine what actions we need to take to know what and it will output.

4th Generation Specific Information for RNG Seeding

The RNG is seeded when "Continue" is selected. The seed of the RNG is not fixed, but is determined by your current date, current time, and the amount of time it took from reset until continuing.

The seed formula:

Given a date/time set the current variables:

Year (4 Digits, 2000-2099)

Month (1-12)

Day (1-31)

Hour (0-23)

Minute (0-59)

Seconds (0-59)

Delay = Seconds between game start and hitting A on the continue screen * 60

* = Multiply

% = Mod (divide and take remainder of)

0x = Numbers prefixed with this are Hexadecimal

(((Month * Day + Minute + Second) % 0x100) * 0x1000000) + ( Hour * 0x10000 ) + (Year-2000 + Delay)

RNG Vs RNG

But wait, there's more. In addition to the RNG described above there is another, which uses a different algorithm, coded into the 4th Generation games. This other RNG (called the IRNG for the duration of this article) is used solely for the generation of egg PIDs.

PID Generation For Eggs using the IRNG

IRNG Advancement

IV Generation For Eggs

X

XX

XX.

XXX

X

XX

..X

XXX

PID Generation for Wild Pokémon

RNG Advancement For Wild Pokémon

Research Needed

Does going in an out of a building with the friendship checker application running trigger IRNG advancement. Method to check: Find initial seed, get egg. Open friendship checker. Go in and out of a door 20 times, close friendship checker get egg. After this check the PIDs of both monsters and see what the gap is on the PID listing.

FAQ

1. What does MOD mean?