0
Where does the randomness of printing a set come from?
I was writing a code like that: print({i for i in input()}) And it resulted to different order of elements every time I run the code. So, what makes this randomness possible in a computer processing with logic or is it really random?
2 Answers
+ 1
it is based on hash function like a dict
https://stackoverflow.com/questions/12165200/order-of-unordered-JUMP_LINK__&&__python__&&__JUMP_LINK-sets
+ 1
@Isaac Cruz Interesting, thank you for the answer.