PHP, chance to "hit"

In a baseball game, if you disregard stats and player traits, theoretically the player should have an equal chance to “not swing”, “swing and miss”, and “swing and hit”.

This works for me by:

    $s = array("ns","sm","sh");
    $s = $s[array_rand($s,1)];
    echo $s;

Now, if I add player traits and say, PlayerA is more perceptive than PlayerB, then PlayerA has a better chance to “swing and hit” the ball.

I just don’t know how to calculate that, given, let’s say, a 10pt scale. 1 being no chance to hit, 10 being really good chance to hit.

Can anyone elaborate on a formula? I am stumped.