I would like to write a utility that will provide me with a relatively unique ID in Java. Something pretty simple, like x bits from timestamp + y bits from random number.
So, how would I implement the following method:
long getUniqueID()
{
long timestamp = System.currentTimeMillis();
long random = some random long
...
return id;
}
BONUS
Any suggestions for other easily obtainable information I could use to form my ID?
note: I am aware of GUIDs and I know Java has a UUID class, but I don't want something that is 128 bits long.