mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-27 15:13:41 +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));
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user