Unique number generator?

Juergen Wagner gandalf at csli.STANFORD.EDU
Sat Sep 10 05:27:28 AEST 1988


Since the hostid is unique, and since there shouldn't be an upper limit to
those numbers, just use
        counter * 2^32 + hostid
(counter is incremented every time a new id is requested). That way, you have
a number which is unique in the network, and you can keep the counters local,
so you don't need overhead for net traffic.

Masking out the lower 32 bits will even tell you where the client got its id
from.

-- 
Juergen "Gandalf" Wagner,		   gandalf at csli.stanford.edu
Center for the Study of Language and Information (CSLI), Stanford CA



More information about the Comp.unix.wizards mailing list