# Varying a percentage based on actual result

I have a desired percentage, 33%, and a 100-sided dice. I also have the number of times the dice has been rolled, and the number of times the dice roll has been successfully under the desired percentage.

How would I go about changing the desired percentage to match the real results? Such that when the dice has been rolled 3 times and succeeded 1 time, the target is the default of 33. Yet when the dice has been rolled 4 times and succeeded 1 time, the target increases (and so becomes easier), and when the dice has been rolled 3 times and succeeded 2 times, the target decreases (and becomes more difficult) by going down to around 16. It's also important that the target never reaches 100% or 0%, ideally capping out at 99% or 1% for a really long string of lucky/unlucky rolls.

If you could post an example with the actual numbers plugged in that would be super helpful, too.

-
 So what you want is what weighting future rolls need to return to the mean? You won't get a closed form unless you limit the number of future rolls somehow. – Simon Hayward Nov 30 '12 at 19:37 Basically the target for each dice roll is changed each roll, based on the number of tries vs successes to attempt to return towards the base, which is 33%. So 3 tries 1 success would be 33 for the next roll (normal), 4 tries 1 success would be around 41 (too many tries), 3 tries 2 success would be around 22 (too many successes). – Mortlanka Nov 30 '12 at 20:19

 What more information would be needed? Also when you say "current" do you mean (successes / tries)? I commented on my original post to hopefully make it clearer. And yeah something smooth is ideal, so it's not immediately obvious what the result would be, eg. if you have 4 tries and only 1 success you can't go "Well I'll definitely succeed next roll!" – Mortlanka Nov 30 '12 at 20:23 @Mortlanka: yes, current is the successes/tries just before a roll. The equation I gave is continuous, but is a linear ramp with corners at the start and end. Plot it and see if you like it. – Ross Millikan Nov 30 '12 at 20:46 So with 3 tries and 1 success: 33-2((1/3)-33)=98.333? I'm not sure I follow. – Mortlanka Dec 1 '12 at 0:38 @Mortlanka: I was using current as a percentage, which seemed to be what you were doing. So with 3 tries and 1 success $33-2(33\frac 13-33)=32\frac 13$ then you round – Ross Millikan Dec 1 '12 at 0:41 Ah, okay. .33-2*((1/3)-.33) definitely appears to work when tries increases, but if successes increases beyond 50% I start getting negatives. 2 tries and 1 success gives me -0.01. Sorry if I'm doing this wrong, I've only got a regular old calculator to work with. – Mortlanka Dec 1 '12 at 0:52