From: Me
Subject: Random number problem


>  return ( SysRandom(TimGetTicks()) % max );
> Unfortunately, this only works as expected on an emulated Palm IIIc and
> fails on all other devices.

I shouldn't be programming over the weekend.  SysRandom() starts a new
sequence of "random" numbers every time it is seeded.  Since TimGetTicks()
doesn't change as fast as the loop executes, it returns the same number
several times.  The solution appears to be to use SysRandom(0), to keep
using the existing seed.

This still leaves me wondering why it appeared to work on the emulated IIIc
(with palmos35-dr4-en-color.rom).



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