Forum > PDAs and Smartphones

Porting Delphi to WinCE

<< < (2/2)

_Bernd:
BTW, I modified the random generator procedure:


--- Code: ---function MyRand(iRange: Integer): Longint;
{
   Random generator, compatible to Delphi 5.
}
var
  edx: Integer;
  lResult: Longint;
begin
  edx:= RandSeed * $08088405;
  Inc(edx);
  RandSeed:= edx;
  lResult:= Longint((Int64(edx) * Int64(iRange)) shr 32);
  if lResult < 0 then
     lResult:= iRange + lResult;
  MyRand:= lResult;
end;

--- End code ---


This procedure is now about 3 times faster than the version, I posted above. I used {$mode delphi} and switched the checking options {$Q-,R-} off.

Regards, Bernd.

Navigation

[0] Message Index

[*] Previous page

Go to full version