Hi,
   just try out this function given below. it will return a rand num between
the given limits.

static UInt16 GetRandomNumber(UInt8 from, UInt8 to)
{
 UInt16 num;
 num = SysRandom(0)/(1+sysRandomMax / (to - from));
 return (from+num);
}

if u want to get a rand num between 0-4 call this func as GetRandomNumber(0,
4);

Regards,
N.Pandiaraj

----- Original Message -----
From: "Geoffrey" <[EMAIL PROTECTED]>
Newsgroups: palm-dev-forum
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Sunday, January 26, 2003 10:51 PM
Subject: SysRandom


> Hi all,
>
> After have a look to the Palm OS Referemce, I know that SysRandom can
> gen a random number from 0 to sysRandomMax.
>
> But no matter what I change to the value of sysRandomMax at file
> \sdk\include\Core\System\SysUtils.h, the result have no different before
> change.
>
> I had change the sysRandomMax to in order to gen a number from 0 to 4:
> #define sysRandomMax  0x0004
>
> But the sysRandomMax still give me a large number. How can I slove it?
>
> Thanks for your advice.
>
> Geoffrey
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/


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

Reply via email to