25.05.2009, 21:31
Hi,
I have a question about randomising events. I've read the wiki and I know how to randomise, I'm just not sure about applying it. I can see how it works when each event has an equal probability of occurring, e.g.
here the probability for either event is equal (1/2), but it could be a 1/3 each or 1/4 each, etc...
What I don't get how to do is have different probabilities for the events occurring, e.g.
Here the probability of something happening appears to be 6/10, and the probability of nothing happening appears to be 4/10. I'm not very good with probability, I can't usually get my head round it, but my way of seeing it is that the probabilities aren't what I said. Surely having something happening at one extreme and nothing at the other extreme would have an effect on the true probabilities? Would it not be better to have the event NOTHING happening on a = 0, 3, 6, 9 (still 4/10 but not at extremes) and the event SOMETHING happening on a = 1, 2, 4, 5, 7, 8 (still 6/10)?
Is there a better and fairer way of doing random events than this? Or am I completely wrong about random() being biased?
Many thanks.
I have a question about randomising events. I've read the wiki and I know how to randomise, I'm just not sure about applying it. I can see how it works when each event has an equal probability of occurring, e.g.
Код:
new a = random(1); if(a == 0) { Do something } else if(a == 1) { Do something else }
What I don't get how to do is have different probabilities for the events occurring, e.g.
Код:
new a = random(9) if(a <= 2) { Do something } else if(a > 2 && a <= 5) { Do something else } else if(a > 6 && a <= 9) { Do NOTHING }
Is there a better and fairer way of doing random events than this? Or am I completely wrong about random() being biased?
Many thanks.