Skip to content

Mighty Gorgons

User Avatar
#23
Auto-translated
Valgarv
It's quite simple and calculated using Bernoulli's formula. However, you need to consider that the probability we need is a sum.
That is, how the algorithm works when calculating the skill's activation.

There are n cows. This means we generate a random number n times, for example, from 1 to 100. Let's say we get the number from 1 to 10 k times. Then, the algorithm checks how many dozens of cows we have in the stack, i.e., it divides n by 10 and rounds up, obtaining the number d. If the resulting k is greater than the number d, then the number of creatures dying from the gaze is d. If k is less than or equal to d, then the number of creatures dying is k.

To calculate the probabilities in percentages, you need to use Bernoulli's formula.



where


Using this formula, we calculate the probability that k cows out of n will use their ability with a chance of p = 10% (or 0.1) for each. But there's a catch: in the algorithm, we also perform, let's say, a truncation based on the number d. That is, in reality, when a stack of n cows attacks, and we are interested in the chance of how many will die from the gaze, we must sum all the probabilities when k is equal to or greater than d.

For example, we have 11 cows, and we are interested in the chance of killing two units with a deadly gaze.

We get: according to Bernoulli's formula, the probability that 2 out of 11 will get a number from 1 to 10 is P(2) = 0.21308126895; 3 out of 11 is P(3) = 0.07102708965; P(4) = 0.0157837977, and so on, up to P(11) = 0.00000000001.

Then, we add up all these probabilities, since they are all favorable to us. The result is:

P = 0.30264312 (or the 30% that is in the table)

I hope I explained it not too clumsily)
Thank you very much! This is exactly what I needed. :smile20:
Stop hard - Go Pro!:smile49: