From e4a5b1e0a6b8bce0e116144ab6b3b5d3674d5f16 Mon Sep 17 00:00:00 2001 From: Freeman Date: Sun, 27 Dec 2020 01:51:04 +0300 Subject: [PATCH] =?UTF-8?q?Random=20function=20bugfix=20=C2=A9=200CodErr?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- RTL/System.pas | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/RTL/System.pas b/RTL/System.pas index 2c17b0b..5e796b2 100644 --- a/RTL/System.pas +++ b/RTL/System.pas @@ -149,7 +149,7 @@ var RandSeed: LongWord; RandCounter: LongWord; -function _RandInt(Range: LongWord): LongWord; +function _RandInt(Range: LongInt): LongInt; function _RandExt: Extended; procedure Randomize; @@ -338,14 +338,14 @@ asm ADD EAX, MinValue end; -function _RandInt(Range: LongWord): LongWord; +function _RandInt(Range: LongInt): LongInt; begin Result := RandInt(0, Range - 1); end; function _RandExt: Extended; begin - Result := 1 / RandInt(2, $FFFFFFFF); + Result := RandInt(0, $FFFFFFFE) / $FFFFFFFF; end; procedure Randomize;