marcuslee
17-11-2010, 09:51
Concerning ˇmpáct!, I've been thinking about how to have events happen based upon a certain probability. For example, there is a 1% chance that something will happen. Or, there is a 30% chance that something else will happen. How can I capture this in code?
I've thought of the following:
x = RND(1, 100)
IF x <= PercentVariable then <<do something>>
So, if there is a 1% chance that something will happen, x will have to be 1. If there is a 30% chance, x will have to be 30 or less. Does this capture the probability I am looking for?
Mark
I've thought of the following:
x = RND(1, 100)
IF x <= PercentVariable then <<do something>>
So, if there is a 1% chance that something will happen, x will have to be 1. If there is a 30% chance, x will have to be 30 or less. Does this capture the probability I am looking for?
Mark