László Sándor <sand...@gmail.com> writes: > OK, I understand. Could anyone suggest a better way to do this, then? > > (Recap: random-looking, close-to uniform assignment of one number out > of four possibilities to strings.)
Use a cryptographic hash function like md5 (deprecated for security purposes but should be ok for this application). The built-in Python hash function is made for hashing symbols and is designed to avoid collisions when you have a bunch of sequential identifiers (a,b,c...). That is, it deliberately does NOT resemble a random function, which would have a certain number of collisions by chance. -- http://mail.python.org/mailman/listinfo/python-list