Personality value: Difference between revisions

Line 52: Line 52:
<code>00000000 00000000 00000000 <span style="background:#FF9999">00000000</span></code><br>
<code>00000000 00000000 00000000 <span style="background:#FF9999">00000000</span></code><br>


From Generation III to Generation V, Pokémon's [[gender]] is determined by the lowest eight digits (the lowest byte, highlighted in <span style="background:#FF9999">red</span> above) of ''p'' in binary form. Mathematically, this can be derived by calculating <code>''p'' [[wp:modulo operation|%]] 256</code>. Below, this value will be referred to as ''p<sub>gender</sub>''.
From [[Generation III]] to [[Generation V]], Pokémon's [[gender]] is determined by the lowest eight digits (the lowest byte, highlighted in <span style="background:#FF9999">red</span> above) of ''p'' in binary form. Mathematically, this can be derived by calculating <code>''p'' [[wp:modulo operation|%]] 256</code>. Below, this value will be referred to as ''p<sub>gender</sub>''.


In a Pokémon species' [[Pokémon base stats data structure in Generation III|base stat structure]], there is a value called the ''gender threshold'', a byte with a value ranging from 0 to 255. With the exception of a few special cases, ''p<sub>gender</sub>'' is compared to the gender threshold to determine if the Pokémon is male or female.
In a Pokémon species' [[Pokémon base stats data structure in Generation III|base stat structure]], there is a value called the ''gender threshold'', a byte with a value ranging from 0 to 255. With the exception of a few special cases, ''p<sub>gender</sub>'' is compared to the gender threshold to determine if the Pokémon is male or female.


If the gender threshold is not a special value (0, 254, or 255), ''p<sub>gender</sub>'' is compared to the gender threshold. If ''p<sub>gender</sub>'' is greater than or equal to the gender threshold, the Pokémon is male, otherwise it is female. Because the comparison to determine gender is greater than or equal, Pokémon are not actually perfectly distributed between male and female according to the ideal ratios.
If the gender threshold is not a special value (0, 254, or 255), ''p<sub>gender</sub>'' is compared to the gender threshold. If ''p<sub>gender</sub>'' is greater than or equal to the gender threshold, the Pokémon is male, otherwise it is female. Because the comparison to determine gender is greater than or equal, Pokémon are slightly more likely to be male than they would be according to the ideal ratios.


From [[Generation VI]] onward, the gender threshold is compared to a random number between 1 and 252 (inclusive) instead of ''p<sub>gender</sub>'' (which is between 0 and 255); this causes Pokémon with a "1:1" gender ratio to actually be distributed according to the ideal ratio.
If a species has a gender threshold of 255, it is genderless species (such as {{p|Magnemite}}). If a species has a gender threshold of 254, it is a female-only species (such as {{p|Nidoran♀}}). If a species has a gender threshold of 0, it is a male-only species (such as {{p|Nidoran♂}}).
 
If a species has a gender threshold of 255, it is genderless species (such as {{p|Magnemite}}), so is always genderless. If a species has a gender threshold of 254, it is a female-only species (such as {{p|Nidoran♀}}), so is always female. If a species has a gender threshold of 0, it is a male-only species (such as {{p|Nidoran♂}}), so is always male.


From [[Generation VI]] onward, the gender threshold is compared to a random number between 1 and 252 (inclusive) instead of ''p<sub>gender</sub>'' (which is between 0 and 255); this causes Pokémon with a "1:1" gender ratio to actually be distributed according to the ideal ratio. All other Pokémon are more likely to be the more common gender than they would be according to their nominal ratio.
{| class="roundy" style="text-align:center; background: #C0C0FF; border: 3px solid blue; margin-bottom: 10px"
{| class="roundy" style="text-align:center; background: #C0C0FF; border: 3px solid blue; margin-bottom: 10px"
! colspan="2" | Gender threshold
! colspan="2" | Gender threshold
3,240

edits