I want to trigger an event with a probability of 25% based on a random number generated between 1 and 100 using:
int rand = random.Next(1,100); Will the following achieve this?
if (rand<=25) { // Some event... } I thought I would use a number between 1 and 100 so I can tweak the probabilities later on - e.g. adjust to 23% by using
if (rand<=23) {...}
Randominstances in a short time window, or they will return the same "random" result.