PRNG in Pokémon: Difference between revisions

From ProjectPokemon Wiki
Jump to navigation Jump to search
(New page: == What is a pseudo-random number generator? == A pseudo-random number generator is an electronic device or software's attempt at creating a sufficiently random number. There are limitles...)
 
Line 28: Line 28:


This algorithm is used for the following:
This algorithm is used for the following:
* Shiny Pokémon Ranger {{p|Manaphy}} egg restriction.
* Shiny Pokémon Ranger [[Manaphy]] egg restriction.
* Determining the species of a Pokémon swarm.
* Determining the species of a Pokémon swarm.
* Determining the Pokémon in the [[Safari Zone]].
* Determining the Pokémon in the [[Safari Zone]].

Revision as of 04:45, 26 February 2009

What is a pseudo-random number generator?

A pseudo-random number generator is an electronic device or software's attempt at creating a sufficiently random number. There are limitless ways of accomplishing this. The degree of sufficient randomness depends on the ability to predict the next result of the algorithm.

First the generator must have a seed, a number to start with. This number is usually a date & time referring to the first time the algorithm is called during the usage of the device or the software's active session.

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.

More information on this topic can be found at:

File:Wikipedia-logo.png Wikipedia has more about this subject:
Pseudo-random number

How pseudo-random numbers are generated 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 Safari Zone.
  • Determining the Pokémon in the Trophy Garden.
  • Mystery Gift shiny restriction for Type 1 Wondercard Pokemon (currently all released with variable natures).