I am currently working on something and it involves a lot of probability.I have standard probabilities and I do this by randomizing a number and then if statements for each one. eg I have 40%, 30%, 20% and 10% of each event. I then have
n = (random number between 0 and 100)
if(n < 40)
else if(n < 70)
else if(n < 90)
else
But now Im trying to affect these probabilities by other factors and I want to update the ifs accordingly. But this involves a lot of calculations as I have to get the new probability and the difference from the last one in order to affect the if statements. So is there another way of programming probability that makes affecting these numbers easier.