>I have been using this function to generate a "random" number:
>
>static UInt16 rand( UInt16 max )
>{
> return ( SysRandom(TimGetTicks()) % max );
>}
>The problem is you keep resetting the Sysrandom function back to the current Ticks, which will always be the same if you are running a loop that takes less than a tick to cycle. Thus, it gives you back the same calculated number. This is more of a problem on a non-IIIc Palm, since they are not as dog-slow as the IIIc is, and are more likely to not get on to the next tick. You are only supposed to initialize Sysrandom with a nonzero number once, then just call it each time with SysRandom(0); >Does anyone know why this is happening? Does anyone have a better idea for >generating a more random series? > > > In truth, the built-in Random nmber generator is not particularly random. There are lots of free pseudo random number generator code bits on the web. For instance, Tom St Denis has one at http://www.geocities.com/tomstdenis/prng.html Rick Bram -- For information on using the ACCESS Developer Forums, or to unsubscribe, please see http://www.access-company.com/developers/forums/
