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

This commit is contained in:
michael 1998-04-08 07:53:31 +00:00
parent 241c9f6020
commit 62001bab9a
3 changed files with 36 additions and 16 deletions

View File

@ -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

View File

@ -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

View File

@ -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