org.davesag.generica.util
Class UuId
java.lang.Object
org.davesag.generica.util.UuId
- public class UuId
- extends Object
Generates a universally unique id number.
- Since:
- Generica 1.0
- Version:
- CVS Revision $Id: UuId.java,v 1.4 2004/03/30 10:12:59 norm Exp $
- Author:
- Dave Sag
http://www.davesag.com
|
Constructor Summary |
UuId()
|
|
Method Summary |
static long |
generate()
Generate a Unique Universal Id Number. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
UuId
public UuId()
generate
public static long generate()
- Generate a Unique Universal Id Number. It does this based on a random
number, with an appended system time in milliseconds, and then an
appended number derived the host IP numbers associated with localhost.
This ensures that within any millisecond interval, for a particular host
machine, there is a 1/2^62 chance of the uuid's ever repeating. It could
be enhanced to actually check for repition but honestly it's overkill I
think. I have tested this on over 1,000,000 iterations and have never
had a repeat.
- Returns:
- the number.
Dave Sag Generica API version 0.5.9 - (prerelease) Copyright © 2003 - 2004 Dave Sag.