Reputation: 5427
I'm writing to have an explanation about checking probabilities in a model built by NetLogo. I have a circumstance that can happen with a probability, for example, of 60%... Thus I generate a number with
let trial random 100
So, it's not clear to me if I have to verifiy that trial is greater than 60 or lower equal than 60, so that the probability is satisfied.
Which is the correct way? Thank you
Upvotes: 3
Views: 2410
Reputation: 14972
You need to check if the result is less than the probability (not less than or equal). For example:
if random 100 < 60 [
do-something
]
Using random 100
will give you a number between 0 and 99 (inclusive). In the example, numbers 0 to 59 will meet the condition, i.e., 60 numbers out of the 100 possible numbers: a 60% probability.
Upvotes: 5