aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJody Bruchon <jody@jodybruchon.com>2020-09-18 14:22:42 -0400
committerJody Bruchon <jody@jodybruchon.com>2020-09-18 14:22:42 -0400
commitfd87f4237892cd8e3120598233c765bfcc6561f6 (patch)
tree3e5d168c4b2cda169fa9b49c0729a9f47484b83a
parent2459b6e1cf928f47b00c63cae23b4a10a912f44f (diff)
downloadhypervideo-pre-fd87f4237892cd8e3120598233c765bfcc6561f6.tar.lz
hypervideo-pre-fd87f4237892cd8e3120598233c765bfcc6561f6.tar.xz
hypervideo-pre-fd87f4237892cd8e3120598233c765bfcc6561f6.zip
Randomize the ArchiveTree the proper Python way
Signed-off-by: Jody Bruchon <jody@jodybruchon.com>
-rw-r--r--youtube_dlc/YoutubeDL.py11
1 files changed, 1 insertions, 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 @@ class YoutubeDL(object):
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