From fd87f4237892cd8e3120598233c765bfcc6561f6 Mon Sep 17 00:00:00 2001 From: Jody Bruchon Date: Fri, 18 Sep 2020 14:22:42 -0400 Subject: [PATCH] Randomize the ArchiveTree the proper Python way Signed-off-by: Jody Bruchon --- youtube_dlc/YoutubeDL.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/youtube_dlc/YoutubeDL.py b/youtube_dlc/YoutubeDL.py index 0bdc98321..595c4be54 100644 --- a/youtube_dlc/YoutubeDL.py +++ b/youtube_dlc/YoutubeDL.py @@ -424,16 +424,7 @@ def preload_download_archive(self): raise lmax = len(lines) if lmax > 10: - pos = 0 - while pos < lmax: - if lmax - pos <= 2: - break - target = random.randrange(pos + 1, lmax - 1) - # Swap line at pos with randomly chosen target - temp = lines[pos] - lines[pos] = lines[target] - lines[target] = temp - pos += 1 + random.shuffle(lines) elif lmax < 1: # No lines were loaded return False