Open main menu

Bulbapedia β


Pseudorandom number generation in Pokémon

995 bytes added, 11:27, 11 September 2013
update for the end of gen V's era; page should be decent for a recap of gens 3-5 RNG
==In the Pokémon games==
===Linear Congruential random number generator (LCRNG)===
In [[Generation III]] and [[Generation IV]], the games use a 32 bit LCRNG.
Let ''Seed'' be a number between 0 and 0xFFFFFFFF or the ''Result'' of a previous call to the equation.
* Encrypting Pokémon data in the [[Save|save file]].
* Generate the [[personality value]] of a [[Wild Pokémon|wild encountered Pokémon]].
* Generate the [[individual values]] of a wild encountered Pokémon in [[Generation III]] and [[Generation IV]].
* Determining the species of a wild Pokémon.
* Determining the [[Pokémon Lottery Corner]] lucky number.
* Determining if an egg will be available at the [[Pokémon Day Care]].
==AlternativeIn pseudorandom[[Generation numberV]], generator==the games instead use a 64 bit LCRNG as follows:
The game also uses a different algorithm to alternate, reroll, or modify a previously randomly generated value. The algorithm works in the same nature; however, the equation changes to:
''Result = [(0x5D588B656C078965 * Seed) + 0x0000000000269EC3]''
===Alternative pseudorandom number generator (ARNG)===
The [[Generation IV]] games also use a different algorithm to alternate, reroll, or modify a previously randomly generated value. The algorithm works in the same nature; however, the equation changes to:
''Result = [(0x6C078965 * Seed) + 0×1]''
* Determining the Pokémon in the [[Trophy Garden]].
* [[Mystery Gift]] shininess restriction for Type 1 [[Wonder Card]] Pokémon (currently all released with variable [[Natures]]).
===Mersenne Twister (MTRNG)===
Found in [[Generation IV]] and later, the Mersenne Twister is another type of random number generator that produces 624 random numbers at once. These random numbers are then stored and used when needed. When all 624 numbers are used, another set is generated.
This algorithm is used for the following:
* Egg PIDs in [[Generation IV]].
* Friendship Change Calculations.
* Sprite Animations in [[Generation V]].
* Individual Values in [[Generation V]].
* AI Move decisions in [[Generation V]].
==RNG Abuse==
'''RNG abuse''', also referred to as '''RNG manipulation,''' is a procedure that manipulates the pseudorandom number generatorgenerators in the main series games to obtain a desired Pokémon. It is commonly used to obtain [[Shiny Pokémon]], Pokémon with high [[individual values]], Pokémon with a specific set of individual values that yield a particular {{m|Hidden Power}} output (regarding [[Type]] and/or move [[Power]]), or Pokémon with certain Natures.
In games where the initial seed (on startup) is predictable, the subsequent "random" numbers are predictable as well. {{game|Emerald}}'s initial seed is always 0. The [[Generation IV]] games use the [[Nintendo DS]]'s [[Days of the week|date]], [[time]], and delay between starting the game and pressing "Continue" to generate the initial seed. {{Gen|V}} games use the [[Nintendo DS]]'s [[Days of the week|date]], [[time]], keys currently pressed, and other entropy data to create a seed moments before the Nintendo logo appears.
The random number generator is used to determine a Pokémon's [[personality value]] and individual values when it is encountered or [[Pokémon Egg|rece]][[Gift Pokémon|ived]]. By searching for initial seeds that satisfy the characteristics required, the player can then hit the target seed and advance 'frames' to receive their target characteristics. There are several methods used to influence a Pokémon's characteristics — for instance, a bred Pokémon and a stationary wild Pokémon's characteristics are generated through different methods.
In Generation [[Generation III]] and [[Generation IV]], there are some limitations. As a player's [[Trainer ID|Trainer ID and Secret ID]] numbers determine a Pokémon's shininess, Shiny Pokémon generated through certain methods can only have certain individual values. Due to [[Wonder Card]] gifts using a timer register to create personality values, it is not possible to manipulate a gift's natureNature. In [[Generation V]], this is no longer the case as the individual values and personality values are determined from two different RNGs.
In the Pokémon fandom, RNG abuse is slightly controversial. Proponents note that RNG abuse does not require a third-party device and that the Pokémon obtained through RNG abuse can be obtained through normal gameplay. In addition, Pokémon obtained through RNG abuse have been used at the {{DL|Play! Pokémon|Video Game Championships}}, an official tournament. However, some players believe that RNG abuse is cheating, as the action of picking a Pokémon's characteristics is similar to using a [[cheating]] device.
==External links==
* [[wp:Pseudorandom number generator|Pseudorandom number generator on Wikipedia]]
* [[wp:Mersenne twister|Mersenne Twister on Wikipedia]]
* [ Smogon's explanation and guide on Pokémon Emerald RNG Abuse]
* [ Smogon's explanation and guide on Generation IV RNG Abuse]