Catch rate/Capture method (Generation III-IV)/Shake checks

To perform a shake check, a random number between 0 and 65535 (inclusive) is generated and compared to b. If the number is greater than or equal to b, the check "fails".

Four shake checks are performed. The Pokémon is caught if all four shake checks succeed. Otherwise, the Poké Ball will shake as many times as there were successful shake checks before the Pokémon breaks free.

If a is 255 or greater, the capture will always succeed and no shake checks will be performed.