Subj : help needed To : Dennis Collins From : Kees Monshouwer Date : Fri Oct 13 2000 11:07 am Hello Dennis, Wednesday October 11 2000 12:41, Dennis Collins wrote to All: DC> the routine has to return a boolean based on a percentage ie TRUE = hit, DC> FALSE = miss, and there are different percentages for the different types DC> of weapons used. DC> hoping someone can shed some light on an easy way to achieve this. I think this example will help === Cut === Program HitOrNot; Const Percent = 75; {Hit %} Var i, HitCount: Word; Function Hit(Percent: Byte): Boolean; begin Hit := Succ(Random(100)) <= Percent end; begin Randomize; HitCount := 0; for i := 1 to 10000 do Inc(HitCount,Byte(Hit(Percent))); Writeln('Shoot ',i,' times and ',HitCount,' of them hit the target.'); end. === Cut === With kind regards, Kees .... Women are like fires: they go out if left unattended. --- FMailX32 1.48b * Origin: Online BBS +31-162-570011 (V34+/ISDN), Geertruidenberg (2:285/326) .