diff --git a/rtl/i386/i386.inc b/rtl/i386/i386.inc index 0dad171f6a..afa733f925 100644 --- a/rtl/i386/i386.inc +++ b/rtl/i386/i386.inc @@ -782,10 +782,23 @@ begin end ['EAX']; end; +Function Random(L: LongInt): LongInt; assembler; +asm + movl $134775813,%eax + mull U_SYSTEM_RANDSEED + incl %eax + movl %eax,U_SYSTEM_RANDSEED + mull 4(%esp) + movl %edx,%eax +end; + { $Log$ - Revision 1.1 1998-03-25 11:18:43 root - Initial revision + Revision 1.2 1998-04-08 07:53:31 michael + + Changed Random() function. Moved from system to processor dependent files (from Pedro Gimeno) + + Revision 1.1.1.1 1998/03/25 11:18:43 root + * Restored version Revision 1.30 1998/03/20 05:11:17 carl * bugfix of register usage list for strcmp and strconcat diff --git a/rtl/inc/system.inc b/rtl/inc/system.inc index 5861639064..728585df0a 100644 --- a/rtl/inc/system.inc +++ b/rtl/inc/system.inc @@ -198,18 +198,6 @@ End; {$R-} -Function Random(l : Longint) : Longint; -{ - the problem Wwth this Function is if l is maxLongint*3/4 then the - probability to obtain a number in the range maxlongint*1/4 to maxlongint*1/2 - is two times smaller than the probability for other numbers ! -} -Begin - Randseed:=Randseed*134775813+1; - Random:=abs(Randseed mod l); -End; - - Function Random : real; { I am not sure about the accuracy of such a value (PM) @@ -414,7 +402,10 @@ End; { $Log$ - Revision 1.2 1998-03-25 23:39:17 florian + Revision 1.3 1998-04-08 07:53:32 michael + + Changed Random() function. Moved from system to processor dependent files (from Pedro Gimeno) + + Revision 1.2 1998/03/25 23:39:17 florian * complete Object Pascal support moved to objpas unit Revision 1.1.1.1 1998/03/25 11:18:43 root diff --git a/rtl/m68k/m68k.inc b/rtl/m68k/m68k.inc index f64c215fd5..4750d503e2 100644 --- a/rtl/m68k/m68k.inc +++ b/rtl/m68k/m68k.inc @@ -721,9 +721,25 @@ XDEF RE_BOUNDS_CHECK @reboundend: end; +Function Random(l : Longint) : Longint +{ + the problem Wwth this Function is if l is maxLongint*3/4 then the + probability to obtain a number in the range maxlongint*1/4 to maxlongint*1/2 + is two times smaller than the probability for other numbers ! +} +Begin + Randseed:=Randseed*134775813+1; + Random:=abs(Randseed mod l); +End; + + + { $Log$ - Revision 1.2 1998-03-27 23:48:06 carl + Revision 1.3 1998-04-08 07:53:32 michael + + Changed Random() function. Moved from system to processor dependent files (from Pedro Gimeno) + + Revision 1.2 1998/03/27 23:48:06 carl * bugfix of STRCONCAT alignment problem Revision 1.18 1998/03/02 04:17:24 carl