Skip to content

Commit 3824800

Browse files
fix: Randomize must be called one time
My calling every time for each torrent it give not the correct random result. [ci skip]
1 parent bf3adb2 commit 3824800

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

source/code/main.pas

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ TFormTrackerModify = class(TForm)
173173
function DecodeTorrentFile(const FileName: UTF8String): boolean;
174174
procedure UpdateTrackerInsideFileList;
175175
procedure UpdateTorrentTrackerList;
176-
//procedure CombineFiveTrackerListToOne(TrackerListOrder: TTrackerListOrder);
177176
procedure ShowTrackerInsideFileList;
178177

179178
procedure CheckedOnOffAllTrackers(Value: boolean);
@@ -599,6 +598,11 @@ procedure TFormTrackerModify.UpdateTorrent;
599598
//initial value is false, will be set to true if read only files are found
600599
SomeFilesAreReadOnly := False;
601600

601+
if FTrackerList.TrackerListOrderForUpdatedTorrent = tloRandomize then
602+
begin
603+
Randomize;
604+
end;
605+
602606
//process all the files one by one.
603607
//FTrackerList.TorrentFileNameList is not sorted it is still in sync with CheckListBoxPublicPrivateTorrent
604608
for i := 0 to FTrackerList.TorrentFileNameList.Count - 1 do

source/code/torrent_miscellaneous.pas

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ procedure RandomizeTrackerList(StringList: TStringList);
183183
//The order of the string list must be randomize
184184
if StringList.Count > 1 then
185185
begin
186-
Randomize;
187186
for i := 0 to StringList.Count - 1 do
188187
begin
189188
StringList.Exchange(i, Random(StringList.Count));

0 commit comments

Comments
 (0)