I'm kind of stumpted at this, but I know there should be a way....... I want to automatically generate a GUID for nodes based upon either/or/and their ip address, port and the system time created (in ms).
The only problem is that the existing code I'm working with makes quite heavy use of arrays for bootstrapping said nodes, which means I need to get a reliably unique int id (which means I can't directly map the ip details to a long or string without breaking array referencing and also a bunch of the message formatting & routing code). The actual 32-bit int range isn't a problem in itself, getting a unique value is.
I've been considering using the UID class in java.rmi (or rather, the hashCode generated) for this, but i'm not sure on how to guarentee / test the uniqueness of this method. And I'm struggling to find too much clear information on the 'net, so I'm asking here.
Any suggestions would be muchly appreciated. (well, duh. Why else would I ask?)
(This is being written in java, obviously - but all I really need is pseudo/code for a non-library dependent solution if someone, for example, knows a good algorith for this in C or c++, etc).
Oh, and part of it was written by other people; my jobs to extend it and help commericialize it. Hence I'm having to fix these stupid little things whilst I'm at it.