Pseudorandom number generation in Pokémon: Difference between revisions

From Bulbapedia, the community-driven Pokémon encyclopedia.
Jump to navigationJump to search
m (robot Adding: fr:RNG)
Line 38: Line 38:


[[de:RNG]]
[[de:RNG]]
[[fr:RNG]]

Revision as of 08:14, 15 June 2010

A pseudo-random number generator is an electronic device or software's attempt at creating a random number. Computers are not designed to be random, and cannot yet be truly 'random' on their own. In order to generate 'random' events in games and other forms of software, they must get as close to looking it as they can. There are limitless ways of accomplishing this. The degree of apparent randomness depends on the ability to predict the next result of the algorithm.

Mechanics

First the generator must have a seed, a number to start with. This number is usually a date and time referring to the first time the algorithm is called during the usage of the device or the software's active session. Seeds are also occasionally derived from user input, as it is highly improbable to do the exact same thing more than once, making it appear 'random'.

This number is put through a complex algorithm and the result is formatted according to the needed context. The raw result then becomes the seed for any subsequent uses of the random generator. Therefore the nature of the generator is a recursive algorithm.

In Pokémon

Let Seed be a number between 0 and 0xFFFFFFFF or the Result of a previous call to the equation.

Result = [(0x41C64E6D * Seed) + 0x6073]

This algorithm is used for the following:

  • Encrypting Pokémon data in the save file.
  • Generate the personality value of a wild encountered Pokémon.
  • Generate the individual values of a wild encountered Pokémon.
  • Determining the species of a wild Pokémon.
  • Determining the lottery number.

Alternative pseudo-random number generator

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 = [(0x6C078965 * Seed) + 0x1]

This algorithm is used for the following:

  • Shiny Pokémon Ranger Manaphy egg restriction.
  • Determining the species of a Pokémon swarm.
  • Determining the Pokémon in the Great Marsh.
  • 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).

See also