# How do I calculate the probable success rate of a game of chance?

In this game I'm programming the player has to test a skill number plus a random number between 1 and 12 to see if it's greater or equal to a difficulty number. What I want to do is calculate the success rate of that test as a percentage. So if the skill test is n + random(12) => x, how do I calculate the probable rate of success as a percentage?

-

You need the random to be at least $x-n$. Each count contributes $\frac {100}{12}=8\frac 13 \%$. So the success rate is $(13+n-x)8\frac 13\%$. The $12$ becomes $13$ because the player wins ties.
@GerhardBahnsen: Then you need to truncate into the range $0\$-100\%$– Ross Millikan Dec 7 '12 at 17:39 Hi. How would I enter this expression on a scientific calculator. I seem to be entering it in all wrong. Thanks. – Gerhard Bahnsen Dec 9 '12 at 17:45 @GerhardBahnsen: I had a typo in the final expression, with$n,x\$ reversed. See if that helps. – Ross Millikan Dec 9 '12 at 20:41