# Changes

## Personality value

, 17 June
Gender
<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>''.

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 notslightly actuallymore perfectlylikely distributedto betweenbe male andthan femalethey would be according to the ideal ratios.

FromIf [[Generationa VI]]species onward,has thea gender threshold of 255, it is comparedgenderless tospecies a(such randomas number{{p|Magnemite}}). betweenIf 1a andspecies 252has (inclusive)a insteadgender threshold of ''p<sub>gender</sub>''254, (whichit is betweena 0female-only andspecies 255(such as {{p|Nidoran♀}});. thisIf causesa Pokémonspecies withhas a "1:1" gender ratiothreshold toof actually0, beit distributedis accordinga tomale-only thespecies ideal(such ratioas {{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"
! colspan="2" | Gender threshold
2,286
edits