Browse Source

* GetRandomBytes calls random only once

git-svn-id: trunk@11123 -
michael 17 năm trước cách đây
mục cha
commit
fb53b5e9f6
1 tập tin đã thay đổi với 8 bổ sung1 xóa
  1. 8 1
      rtl/objpas/sysutils/sysutils.inc

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

@@ -569,6 +569,9 @@ begin
   Result := DoForceDirectories(SetDirSeparators(Dir));
 end;
 
+Var
+  GUIDCalledRandomize : Boolean = False;
+
 Procedure GetRandomBytes(Var Buf; NBytes : Integer);
 
 Var
@@ -577,7 +580,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;