mirror of
https://github.com/blackjack4494/yt-dlc.git
synced 2024-12-30 11:46:57 +00:00
Randomize the ArchiveTree the proper Python way
Signed-off-by: Jody Bruchon <jody@jodybruchon.com>
This commit is contained in:
parent
2459b6e1cf
commit
fd87f42378
1 changed files with 1 additions and 10 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue