Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!ucbvax!decwrl!labrea!csli!gandalf From: gandalf@csli.STANFORD.EDU (Juergen Wagner) Newsgroups: comp.unix.wizards Subject: Re: Unique number generator? Message-ID: <5412@csli.STANFORD.EDU> Date: 9 Sep 88 19:27:28 GMT References: <775@goofy.megatest.UUCP> Reply-To: gandalf@csli.stanford.edu (Juergen Wagner) Organization: Center for the Study of Language and Information, Stanford U. Lines: 12 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@csli.stanford.edu Center for the Study of Language and Information (CSLI), Stanford CA