samedi 11 janvier 2020

Why does random.shuffle(Array) have the same return across multiple threads? How do I correct this?

The following code shuffles a large array of data into the exact same order in three different threads. Why is it not uniquely shuffling them?

Settings = json.loads(open('Settings.json', 'r').read())

def update_assets():
        Array = Settings['Location']
        random.shuffle(Array)
        print(Array)

for x in range(3):
    threading.Thread(target = update_assets).start()



Aucun commentaire:

Enregistrer un commentaire