@Xavion Yeah, I have somewhere a knot in my brain…
My understanding is that this line:
local random_number=math.random(0,100)
will generate a number between 0 and 100. Which is what I want, as there is might happen somewhere between 1 and 100 times, but there is also the option that it is not happening. So this should be 101 options, no?
With this line:
if (random_number<probability_plan) then
I am checking if the random number is below the probability which should be achieved based on the user input. Here it should actually be <=, because it should also count the same probability as a fulfilling the condition. So adjusting “=” to “<=” is something which would be understandable to me, to cover the probability of 100%. However…
Now let’s take a look on the extremes of 0 and 100. For 100 “<=” would work and it would result in a positive count for probability. For 0, this formula would not work as a 0 would result in a fulfillment of the condition, which is wrong. So, actually I might leave the “=” as it is and increase the desired number to 101 (so if the random number is 100, it will be sufficient to fulfill the condition), instead of decreasing the random generated number to 99, no?
Update: Changed some wording to make it more clear what I am thinking.