Pseudorandom number generation

Revision as of 02:30, 26 February 2009 by Sabresite (talk | contribs) (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 limitless...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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: Pseudo-random_number

How are Psuedo-Random Numbers Generated in Pokemon

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 Pokemon Data in the save file.
  • Generate the Personality Value of a wild encountered Pokemon.
  • Generate the Individual Values of a wild encountered Pokemon.
  • Determining the species of a wild Pokemon.
  • 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 Pokemon Ranger Manaphy egg restriction.
  • Determining the species of a Pokemon swarm.
  • Determining the Pokemon in the Safari Zone.
  • Mystery Gift shiny restriction for Type 1.