Bläddra i källkod

Merged revisions 11123 via svnmerge from
svn+ssh://svn.freepascal.org/FPC/svn/fpc/trunk

........
r11123 | michael | 2008-05-29 15:16:07 +0200 (Thu, 29 May 2008) | 1 line

* GetRandomBytes calls random only once
........

git-svn-id: branches/fixes_2_2@11124 -

michael 17 år sedan
förälder
incheckning
b8bd11a79f
1 ändrade filer med 8 tillägg och 1 borttagningar
  1. 8 1
      rtl/objpas/sysutils/sysutils.inc

+ 8 - 1
rtl/objpas/sysutils/sysutils.inc

@@ -567,6 +567,9 @@ begin
   Result := DoForceDirectories(SetDirSeparators(Dir));
 end;
 
+Var
+  GUIDCalledRandomize : Boolean = False;
+
 Procedure GetRandomBytes(Var Buf; NBytes : Integer);
 
 Var
@@ -575,7 +578,11 @@ Var
 
 begin
   P:=@Buf;
-  Randomize;
+  If Not GUIDCalledRandomize then
+    begin
+    GUIDCalledRandomize:=True;
+    Randomize;
+    end;
   For I:=0 to NBytes-1 do
     P[i]:=Random(256);
 end;