On 23.09.2011 13:08, Denis Kudriashov wrote:
Hello,
I use hash message to generate unique object id. (unique between
current memory objects).
And I catch situation when two objects has same hash value. Objects
has been created in loop almost at same time.
So my question - is it really possible?
Can it be bug in my current VM which I used? (it is cog but very old)
Old Cog vm's gave objects sequential and (in some cases identical) hash
values.
IIRC, current ones no longer give identical.
However, there are only 4096 unique identity hashes, so you need another
solution.
What you can recomment me for unique object id?
Best regards,
Denis
Either a unique sequence, or UUID as Mariano suggests (sequence is
probably faster).
Some care is required if you need it to be thread-safe though.
For an approach to avoid (and some more discussion of the same problem),
you can read
http://forum.world.st/DateAndTime-and-TimeStamp-precision-td1486046.html#a1557663
Cheers,
Henry