Mats,
I don't think your previous post made it through...
jim
Hmm, if not then I get another try (if somebody removes posts with
errors I hope I have better luck with this one :-)
The suggested algorithm was:
1. Split a timestamp (long) into two int's.
2. Increment a sequence counter (int).
3. Use the java.util.zip.CRC32 class to generate a CRC value for
these 3 integer values.
4. Return this value.
The returned crc32 is 32 bit number as far as I know.
This is way to small since the risk of having generated two identical
id's reach 50% after only 2^16 id's (due to the birthday paradox).
Even if the crc32 returns a full long, the risk of duplicates may be
to big to ignore if you are creating large numbers of id's.
My suggestion is to replace the crc32 with a hash from
java.security.MessageDigest. Those are 128 bits or more.
_
Mats Lofkvist
[EMAIL PROTECTED]
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".