Micah Cowan wrote:
Yes, that appears to work quite well, as long as we seed it right;
starting with a consistent Xâ‚€ would be just as bad as trying them
sequentially, and choosing something that does not change several times
a second (such as time()) still makes it likely that multiple
invocations will choose the same first port. Probably, /dev/random as
first choice, falling back to by gettimeofday() where that's available.
I don't know what Windows would use.

QueryPerformanceCounter, if it seems trustworthy (i.e. != 0), which might be what Hrvoje pointed out. Otherwise the UUID generator is theoretically sufficient (and there is always getpid() which can be used to salt time... which is likely what the UUID generator does, anyway).

--
Matthew
"Five is right out!"
  -- Cleric (from Monty Python's Quest for the Holy Grail)

Reply via email to