There has to be some kind of formula that the game goes through to calculate whether a Pokemon is caught.
Bulbapedia explains it all.