From: "Geoffrey" <[EMAIL PROTECTED]>
>
> If I mod it with 5, then the result will be 0, 1, 2, 3, 4, 0, 1, 2, 3,
> 4, 0, 1 (each have same probability to gen), then the chance of the "0"
> and "1" return is 3/12 and the other is 2/12. The probaility will not be
> same for each value!

Interesting. If your sysRandomMax were 9 instead, then all values would have
an equal chance. Whenever sysRandomMax + 1 isn't a multiple of the desired
range, there is a bias against the higher numbers.

When sysRandomMax is large, the bias is small, but it's still present.


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to