I am developing a game where every thing in the game world is represented by an global unique identifier.
Those ids each measure 64 bits and are generated by hashing together the time of creation, the machines network address and a random number. According to Wikipedia's article on the Birthday problem, the probability of a hash collision is 0.1% for two hundred million records.
Since it is unlikely that I'm going to get that much records, one could consider that no hash would ever collide. But I don't want to hope for that, but let my application handle the rare case of a id collision, thus hash collision.
Otherwise, the behavior would be very undesired because two independent things in the game world would have a connection, thus share their properties like position, movement, health points, and so on.
How can I handle hash collisions? How are they handled typically?
unsigned long long int
instead of arrays to store the id. Moreover, I don't have that much records. But anyway, the question remains for any id length. – Yarn