github.com/afumu/libc@v0.0.6/musl/src/temp/__randname.c (about)

     1  #include <time.h>
     2  #include <stdint.h>
     3  
     4  /* This assumes that a check for the
     5     template size has already been made */
     6  char *__randname(char *template)
     7  {
     8  	int i;
     9  	struct timespec ts;
    10  	unsigned long r;
    11  
    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;
    16  
    17  	return template;
    18  }