上下文源代码属于libuuid-1.0.3 randutils.c,在rand()>> 7中有什么意义。我认为没有必要。
void random_get_bytes(void *buf, size_t nbytes)
{
size_t i, n = nbytes;
int fd = random_get_fd();
int lose_counter = 0;
unsigned char *cp = (unsigned char *) buf;
if (fd >= 0) {
while (n > 0) {
ssize_t x = read(fd, cp, n);
if (x <= 0) {
if (lose_counter++ > 16)
break;
continue;
}
n -= x;
cp += x;
lose_counter = 0;
}
close(fd);
}
for (cp = buf, i = 0; i < nbytes; i++)
*cp++ ^= (rand() >> 7) & 0xFF;
...
return;
}