mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-29 12:20:28 +02:00
* GetRandomBytes calls random only once
git-svn-id: trunk@11123 -
This commit is contained in:
parent
8b94b4b849
commit
fb53b5e9f6
@ -569,6 +569,9 @@ begin
|
|||||||
Result := DoForceDirectories(SetDirSeparators(Dir));
|
Result := DoForceDirectories(SetDirSeparators(Dir));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Var
|
||||||
|
GUIDCalledRandomize : Boolean = False;
|
||||||
|
|
||||||
Procedure GetRandomBytes(Var Buf; NBytes : Integer);
|
Procedure GetRandomBytes(Var Buf; NBytes : Integer);
|
||||||
|
|
||||||
Var
|
Var
|
||||||
@ -577,7 +580,11 @@ Var
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
P:=@Buf;
|
P:=@Buf;
|
||||||
Randomize;
|
If Not GUIDCalledRandomize then
|
||||||
|
begin
|
||||||
|
GUIDCalledRandomize:=True;
|
||||||
|
Randomize;
|
||||||
|
end;
|
||||||
For I:=0 to NBytes-1 do
|
For I:=0 to NBytes-1 do
|
||||||
P[i]:=Random(256);
|
P[i]:=Random(256);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user