fix misleading comment in strstr
[musl.git] / src / temp / __randname.c
blob2bce37a0c4a27f73fc6e50757a758e1f8125feec
1 #include <time.h>
2 #include <stdint.h>
4 /* This assumes that a check for the
5 template size has already been made */
6 char *__randname(char *template)
8 int i;
9 struct timespec ts;
10 unsigned long r;
12 __clock_gettime(CLOCK_REALTIME, &ts);
13 r = ts.tv_nsec*65537 ^ (uintptr_t)&ts / 16 + (uintptr_t)template;
14 for (i=0; i<6; i++, r>>=5)
15 template[i] = 'A'+(r&15)+(r&16)*2;
17 return template;