Catch rate/Capture method (Generation II)/Shake checks

First, a check is performed to determine whether the Pokémon is caught at all. A random number between 0 and 255 is generated, and if this number is less than or equal to a, the Pokémon is caught.

Shake checks are only performed if the Pokémon is not caught. A single shake check consists of generating a random number between 0 and 255 and comparing it to b. This is done at most three times, but if the number generated in a given shake check is greater than or equal to b, no further shake checks will be performed. The number of times the ball shakes is the same as the number of shake checks that were performed.