This question already has an answer here:
First of all, I know that I should never attempt what I describe in this question and this is purely hypothetical so please don't yell at me.
Python sets don't maintain order because they are hash-maps without the map part. So I was wondering how well they are at randomizing things. It obviously isn't enough for crypto, and won't work on ints (because Python hash is identity on ints), but is it good enough for games and stuff?
It makes sense that it would work decently because its modding on a hash, but I'm not really sure how good that hash is and how well it'll work for randomizing.
P.S: Sets will always return the same shuffle for the same values, but you can assume that that isn't a problem.
Aucun commentaire:
Enregistrer un commentaire