# Personality value

The personality value is a doubleword that controls many constant characteristics of a certain Pokémon.

For every in-depth explanation, take p to represent the actual doubleword value. Furthermore, pw will denote the lowest word value of p where necessary.

# Gender

Gender is determined by the least significant byte of the personality. Each Pokémon has its own value to check this byte agains in its Base Stats structure. If the value in the structure is 0xFF, the Pokémon is always genderless. Otherwise, if the lowest byte of p is less than or equal to the byte in the base stats, the Pokémon is considered female.

# Nature

Nature is (p modulo 25).

The number acquired corresponds to the personality as follows:

 p mod 25 Nature 0 Hardy 1 Lonely 2 Brave 3 Adamant 4 Naughty 5 Bold 6 Docile 7 Relaxed 8 Impish 9 Lax 10 Timid 11 Hasty 12 Serious 13 Jolly 14 Naive 15 Modest 16 Mild 17 Quiet 18 Bashful 19 Rash 20 Calm 21 Gentle 22 Sassy 23 Careful 24 Quirky

# Shininess

Shininess depends not solely on the personality, but the zero-value found to be (p xor [Trainer ID]). Take the higher and lower word of this value and xor them again to each other. If the resulting value is less than 8 then the Pokémon is shiny. That means that there's a 2/65025 chance of getting a shiny Pokémon.

# Spinda's Spots

Interpret each byte in p as (x,y) coordinates of each spot. The least significant 4 bits (lowest nibble) in each byte is the x-coordinate, the highest is the y-coordinate.

# Unown's Letter

Unown's letter is taken from the modulus of the combination of the least significant 2 bits of each byte in p. That is, the letter (0-27) can be expressed as:

up = (((p and 0x00000003) or ((p and 0x00000300) shr 6) or ((p and 0x00030000) shr 12) or ((p and 0x03000000) shr 18)) modulo 28)

# Wurmple's evolution

Wurmple's evolution isn't random. Take (pw modulo 10) in the following ternary expression:

((pw modulo 10) < 5) ? SILCOON : CASCOON

If it resolves to a value below 5, it's a Silcoon, otherwise it's a Cascoon.