<snip>
   I chose to implement this "unique" number is as follows:

       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.
   <snip>

Isn't a crc32 32 bits?  If so, the risk of getting two identical
id's is much to high (for two random 32 bit numbers there is a
1/65536 chance of them being equal). Even if the crc32 result is
a full long, the 64 bits may still not be enough if you generate
very large numbers of id's.

I suggest you use java.security.MessageDigest instead, e.g. md5
generates a 128 bit hash.

      _
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".

Reply via email to