Browse Source

+ Changed Random() function. Moved from system to processor dependent files (from Pedro Gimeno)

michael 27 years ago
parent
commit
62001bab9a
3 changed files with 36 additions and 16 deletions
  1. 15 2
      rtl/i386/i386.inc
  2. 4 13
      rtl/inc/system.inc
  3. 17 1
      rtl/m68k/m68k.inc

+ 15 - 2
rtl/i386/i386.inc

@@ -782,10 +782,23 @@ begin
   end ['EAX'];
   end ['EAX'];
 end;
 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$
   $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
   Revision 1.30  1998/03/20 05:11:17  carl
     * bugfix of register usage list for strcmp and strconcat
     * bugfix of register usage list for strcmp and strconcat

+ 4 - 13
rtl/inc/system.inc

@@ -198,18 +198,6 @@ End;
 
 
 {$R-}
 {$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;
 Function Random : real;
 {
 {
   I am not sure about the accuracy of such a value (PM)
   I am not sure about the accuracy of such a value (PM)
@@ -414,7 +402,10 @@ End;
 
 
 {
 {
   $Log$
   $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
     * complete Object Pascal support moved to objpas unit
 
 
   Revision 1.1.1.1  1998/03/25 11:18:43  root
   Revision 1.1.1.1  1998/03/25 11:18:43  root

+ 17 - 1
rtl/m68k/m68k.inc

@@ -721,9 +721,25 @@ XDEF RE_BOUNDS_CHECK
 @reboundend:
 @reboundend:
  end;
  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$
   $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
     * bugfix of STRCONCAT alignment problem
 
 
   Revision 1.18  1998/03/02 04:17:24  carl
   Revision 1.18  1998/03/02 04:17:24  carl