ID:161740
 
I don't really get the prob() function. I want to be able to pick between the numbers 1, 2 and 3 with equal probabilities of exactly 1/3. I don't know if rand() does this properly or not. As for prob(), if you have, say, prob(50) AND prob(25), does that mean one event has a probability of 0.5 and the other 0.25 or does it mean that one event has a probability of 2/3 and the other 1/3 or what?
Are both checks called in the same statement? If so that means there'll be a probability of roughly 12/100 to succeed ((100/2)/4).
prob(n) returns true n% of the time. So prob(50) returns true half the time, false the other half - prob(25) returns true one quarter of the time, false the other three quarters.

You're looking for the rand() function - that gives you a uniformly distributed pseudorandom number between two values.
Abhishake wrote:
I don't really get the prob() function. I want to be able to pick between the numbers 1, 2 and 3 with equal probabilities of exactly 1/3. I don't know if rand() does this properly or not.

I doubt rand() does this properly. pick(), however, was designed for this. If you use pick() without any prob() calls, then all choices are equally likely (in theory), so you can just use pick(1,2,3). Taken from the DM Reference:

Also, to pick a value randomly from a list, simply pass the list as the sole argument into pick(). In this case, there is no provision for weighting the probabilities. All items in the list are equally likely.

As far as the specifics of pick() and prob() working together, I'm afraid I can't say. A prob(200) is loosely defined as "twice as likely as the norm," while I can't seem to think of how this "norm" is calculated, when other values might have a prob(150) or a prob(15). In the event of three objects, one with prob(50) and the others with prob(25), I'd imagine that the one with prob(50) has a probability of 2/4 (0.5) and the other two have a probability of 1/4 (0.25).

Hiead