This question already has an answer here:
I would like to do the following:
def reorder_files(files, seed=None):
if seed:
random.seed(seed)
random.shuffle(files)
However, this creates a bug when I run it with seed=0
because if 0
will not enter the if
statement. What is the proper way to check for a random seed and shuffle if it's found, but allow 0 to be passed as an input?
Aucun commentaire:
Enregistrer un commentaire