mardi 20 juillet 2021

Python random seed that returns the same random results on all instances

I am currrently using:

>>> import random
>>> foo = [1,2,3,4,5,6,7,8,9]
>>> random.Random(123).shuffle(foo)
>>> foo
[7, 4, 2, 6, 5, 8, 3, 9, 1]

But when ran on different instances this will return different results. Is there any way to have them return the same results no matter the instance?




Aucun commentaire:

Enregistrer un commentaire