4 ms·
Yes across processes. You don't want to change (reseed) the hash function after the dictionary is created. (At least then you need to rehash everything.) Seede
by thomasahle 10y ago
Yes across processes. You don't want to change (reseed) the hash function after the dictionary is created. (At least then you need to rehash everything.)
Seeded hashing was introduced to python 3.2.3: https://docs.python.org/3.3/using/cmdline.html#cmdoption-R https://docs.python.org/3.3/using/cmdline.html#cmdoption-R
$ python3 --version
Python 3.5.2
$ python3 -c "print(hash('a'))"
6106879154137036349
$ python3 -c "print(hash('a'))"
9160572615033669802
$ python3 -c "print(set('abcdef'))"
{'d', 'f', 'e', 'b', 'c', 'a'}
$ python3 -c "print(set('abcdef'))"
{'e', 'f', 'd', 'a', 'b', 'c'}
Note that there is no guarantee that this ordering is uniformly random. (Though it probably is.)