+ /* Since the multiplications will have a larger effect on the
+ upper bits than the lower bits, after every addition in the
+ seed, perform a bitwise rotate by an odd number, resulting
+ in a better distribution of randomness throughout the bits.
+ -- Brian Carlson, 2010.
+ */
+#define ROT(X,N) (((X)<<(N)) | ((X)>>((sizeof(unsigned int)*8)-(N))))
+ seed = (999U * (unsigned int) tp.tv_sec);
+ seed = ROT (seed, 11);
+ seed += (1001 * tp.tv_usec);
+ seed = ROT (seed, 7);
+ seed += (1003 * getpid());
+ seed = ROT (seed, 13);