PokéBase - Pokémon Q&A
1 vote
3,291 views

How are they calculated?

by
Do you want to know all the ways they can increase from the regular 1/8192 (before gen 6) or 1/4096 (gen 6 onward)?

2 Answers

6 votes

This answer will explain the underlying calculations that occur to determine whether a Pokemon will be Shiny. The calculation of Shiny odds changed dramatically between Gen 2 and 3, so I will explain those separately.

Gen 2

In Gen 2, Shiny odds are determined by the Pokemon's IVs. In Gen 2, IVs are whole numbers ranging from 0 to 15 (and therefore there are 16 possible values). Each individual Pokemon has an IV associated with each of its stats. For the Pokemon to be Shiny, its IVs must satisfy the following conditions:

  1. IVs in Speed, Defence and Special are all equal to 10.
  2. Attack IV is equal to 2, 3, 6, 7, 10, 11, 14, or 15.

A few quirks with Gen 2 are that the Special Defence and Special Attack IVs are always the same (named the "Special IV"), and the HP IV is determined using the other IVs (details). As such, only four different IVs (with 16 possibilities each) are uniquely generated, leading to 16**4 = 65,536 distinct combinations of IVs.

You can see from the above two conditions that there are only eight combinations among the 65,536 that would lead to a Shiny Pokemon. (This is because there is one way to satisfy the first condition and eight ways to satisfy the second; 1 * 8 = 8.) Therefore, if we take all combinations to be equally likely to occur, then Shiny odds for Gen 2 are 8/65536. This simplifies to 1/8192.

Due to how IVs are inherited during breeding in Gen 2, the effective Shiny odds when breeding a Shiny Pokemon and hatching a Pokemon of the opposite sex to the Shiny Pokemon are 1/64.

Gen 3 onward

In Gen 3 onward, Shiny odds are no longer determined using IVs. Instead, they are determined using the following three properties of the Pokemon in question:

  1. its personality value (a new feature in Gen 3), which refers to a 32-bit unsigned integer that is randomly generated when the Pokemon is encountered.
  2. its trainer ID number (TID), which is a 16-bit unsigned integer that it gets from its Original Trainer. (This is the "ID No." you see on summary screens.)
  3. its secret ID number (SID), which is a separate 16-bit unsigned integer that it gets from its Original Trainer. It is a "secret" ID because the game never shows it to you.

A "bit" is a digit in binary, i.e. a 0 or 1. When calculating Shiny odds, it is easiest to think of personality values, TIDs, and SIDs as binary numbers (meaning: sequences of 0s and 1s), because the game uses bitwise operations in its calculations (meaning: it compares the zeroes and ones in binary, instead of doing standard operations with decimal numbers). For example, a possible personality value is:

00110001011101111100011110010100

This set of 32 bits represents the number 829,933,460 in decimal notation; but again, this isn't important, as the game calculates using binary. Now, take the following binary TIDs and SIDs as an example:

TID: 0111010100100100 (aka 29,988)
SID: 0010111100000111 (aka 12,039)

To decide if the Pokemon is Shiny, the game uses a common binary operation called bitwise exclusive or (denoted with ^), which creates a new binary number. To do this, it takes two binary numbers (like the TID and SID above), and compares each bit; if the bit at position x is different for the two sequences, then the output number at position x will be 1. Otherwise, it will be 0.

With this in mind, we do the following calculation used by the game: TID ^ SID ^ first 16 bits of the personality value ^ last 16 bits of the personality value. We then convert this binary number back to base 10 (aka decimal notation); if that number is less than 8, the Pokemon will be Shiny. Let's try it:

TID ^ SID = 0101101000100011; call this "a"
a ^ first 16 bits... = 0110101101010100; call this "b"
b ^ last 16 bits... = 1010110011000000; call this "c"

If we convert "c" back to decimal notation, we get the number 44,224. Unfortunately, 44,224 is much higher than 8, so our example Pokemon is not Shiny. If you want a similar example that does turn into a Shiny, see this Bulbapedia section.

Hopefully, you can see from the example that the Shiny chance is 8 divided by the biggest number you can store in an unsigned 16-bit integer. It is no mistake that this number is 65,536, and the Shiny rate is therefore 8/65536 (or 1/8192) -- the same as Gen 2!

But what about Gen 6+, where the base Shiny rate is 1/4096? Very simple; all that changed is the decimal number from our calculation needs to be less than 16 instead of 8. Thus, the Shiny rate doubles to 16/65536, aka 1/4096.

Aside: In Gen 7+, TIDs and SIDs work a bit differently, but this is irrelevant to our calculations. To navigate the differences, sandwich together the decimal TID and SID (in that order), then convert that number to binary, then split the binary number in half to get your two 16-bit binary numbers.

What about Masuda method, etc.?

Most techniques for boosting the Shiny rate involve "re-rolling" the personality value a certain number of times, keeping any personality value that causes the calculation above to turn up Shiny. For example, in Masuda method you get up to four re-rolls of the personality value per egg; in other words, the game will try five times instead of one to get you a Shiny.

In Gen 4, this gives you effective odds of approx. 5/8192 (which is itself approx. 1/1638). In later generations, your chances get even better, as Masuda method gives you up to five re-rolls (i.e. six tries) in Gen 5+, and obviously the base rate itself doubles to 1/4096 in Gen 6.

Other methods like the PokeRadar change up the calculation technique once again; see here and here for details about that.

by
2 votes

Gen III onward:

TrainerID xor SecretID xor PersonalityValue31..16 xor PersonalityValue15..0

Gen II:

If a Pokémon's Speed, Defense, and Special IVs are all 10, and its Attack IV is 2, 3, 6, 7, 10, 11, 14 or 15, it will be Shiny.

Source

by
reshown by
> <code>TrainerID **xor** SecretID **xor** PersonalityValue<sub>31..16</sub> **xor** PersonalityValue<sub>15..0</sub></code>

This formatting should make the "Gen III onward" part look exactly like the Bulbapedia article.
This answer gives two pieces of information that help determine Shiny Pokemon odds, but doesn't explain how Shiny Pokemon odds work and doesn't calculate the odds like the question requests.