> From: Ng Wei Gee [mailto:[EMAIL PROTECTED]]
> StrIToA (qwe, (Int32)  (( SysRandom(0)*4096 ) / sysRandomMax ));
> The qn is: how come qwe will either be only 0 or 1??

Because (SysRandom(0) * 4096) yields a 16-bit number, not a 32-bit number as
you may be  expecting, and sysRandomMax is 0x7FFF, so 0 and 1 are the only
possible results of the division.

> I need to generate a random number between 0 to 4095.

Consider: SysRandom( 0 ) % 4096

> The other thing is: since sysRandomMax in OS3.5 is 9999,
> while it is 32767 in the older OSes

Huh?  sysRandomMax is still 0x7FFF == 32767 in 3.5 and 4.0.

-slj-


-- 
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