Throwing rocks makes the Pokémon easier to catch, but more likely to run away. Throwing bait has the opposite effect; it makes the Pokémon more likely to stay but slightly harder to capture.
EDIT: As of Gen III:
>The Safari Game mechanics were overhauled to more closely resemble the one in the Hoenn Safari Zone. Like it, there is an additional "catch factor" that begins at 100/1275 of the Pokémon's catch rate (rounded down). Each species of Pokémon also has its own "escape rate", unlike in the Hoenn Safari Zone, which is never modified.
Like Generation I, a Pokémon will be angry or eating whenever Bait or Rocks are thrown. If Bait is thrown, it will be "eating" for 2-6 turns, during which the catch factor is halved. If Rocks are thrown, it will be "angry" for 2-6 turns, during which the catch factor is doubled. Being "angry" or "eating" is mutually exclusive, though modifications to the catch factors will stack (reverting to its original value whenever the Pokémon is neither "angry" nor "eating"). Whenever a Safari Ball is thrown, the catch factor is converted back to a catch rate by multiplying by 1275/100 and rounding down.
At the end of a turn, a random number from 0 to 99 is generated, and is compared to 5 times its "modified escape factor": 1275/100 of the escape rate (rounded down), which is doubled if the Pokémon is "angry" or quartered (rounded down) if the Pokémon is "eating". If the random value is less, the Pokémon escapes. ~ Bulbapedia