At 03:45 PM 11/6/2000, Fitzpatrick, Joe wrote:
>You can't, you have to turn it into a smaller number yourself.  Use the
>modulo (%) operator (ex. <random> % 100 will return a value from 0-99).

I think modulo 100 won't retain a perfect uniform distribution since sysRandomMax + 1 
is not a multiple of 100. Probably better would be to mask off the bits you don't need 
(&& 0xFF in this case), then test if the value is within range (< 100 in this case), 
and retry if not.
--
Peter Epstein
Palm Inc. Developer


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

Reply via email to