Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!decwrl!megatest!djones From: djones@megatest.UUCP (Dave Jones) Newsgroups: comp.unix.wizards Subject: Unique number generator? Message-ID: <775@goofy.megatest.UUCP> Date: 9 Sep 88 02:04:36 GMT Organization: Megatest Corporation, San Jose, Ca Lines: 17 What's the best way for a process to generate a network-wide unique number which will remain unique over time? (A very, very high probability of uniqueness may have to be good enough.) Just off the top of my head, I think of this idea: Add together the number that you get from gettimeofday(), and the number you get from getpid(), and a number you get by hashing the string obtained from gethostname(). Maybe you want to multiply the getpid number by 100000 or so before you add it. I thought of using the ethernet machine address, which admittedly adds a little bit more non-portability, but I don't know exactly how to look it up at runtime anyway. Anybody got an idea on this? Sun gurus: Can the yellow-pages daemon or the portmapper be any help?