News for hackers. Stuff that matters.
Re:A New Algorithm for Controlled Randomness by fenomas on Saturday August 31, 2019 @11:58PM (#20850422)
An easy way to do the odds analytically is to calculate the average expected number of trials needed for a success, and then note that the overall average success rate is the inverse of that.

E.g. in the author's example, where the rate starts at 5% and increases by 5% with each failure, the expected number of trials needed for a success would be:

    sum = 1 * 0.05 +                // hit the first trial
          2 * 0.95 * 0.10 +         // missed first, hit second
          3 * (0.95*0.9) * 0.15 +   // missed first two, hit third
          // ..and so on
Summing up that loop gives 5.29 for the expected number of trials, the inverse of which is 18.9%, matching the author's observed result.
Re:A New Algorithm for Controlled Randomness by andreareina on Sunday September 01, 2019 @12:40AM (#20850499)
The problem is the inverse: starting with 18.9%, how do you get the 5+5%
Re:A New Algorithm for Controlled Randomness by fenomas on Sunday September 01, 2019 @02:08AM (#20850755)
The author doesn't examine that question. They comment that one can run a large number of trials to estimate the 18.9 given the 5+5, and my post is how to get that answer analytically for any sequence of probabilities.

For the reverse case, there are arbitrarily many such sequences that would average out to any given value. In practice someone using this technique for gamedev wouldn't necessarily only want X+X%.