I have two values. One can be greater than the other, or less, or equal. In the simple game that I´m writing on Java,I have 2 armies, and based on the number of soldiers on this army, I want to generate a more powerful one, to compensate the minor number of soldiers in one of the armies.
For example, if I have 4 soldiers on one army, and 7 soldiers on the other, the probability of generate the correct random number for the 7 soldiers army, must be minor than the probability on the 4 soldiers army. Based on the difference between these two values, probability must change.
I thought this method:
-
4 / 7 = 0.57 = 57% less probabilities to obtain the desired value on the 7 soldiers army. So, with this logic, if random number for the minor army is between 1 and 5, with the another will be 157% 5, which is equal to 7.85 (applying ceil method, this will result in a number between 1 and 8).
-
Another method might be the greater number by the sum of both numbers, 7 / 15 = 0.46 = 46% aprox. So 100 - 46 = 54% less
probabilities to obtain the number I want.
I want the probability of the minor value to be constant, only change the one of the greater value based on the difference of both.
Aucun commentaire:
Enregistrer un commentaire