mirror of https://git.musl-libc.org/git/musl
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
465 B
21 lines
465 B
#include <string.h>
|
|
#include <time.h>
|
|
#include <stdint.h>
|
|
|
|
int __clock_gettime(clockid_t, struct timespec *);
|
|
|
|
/* This assumes that a check for the
|
|
template size has already been made */
|
|
char *__randname(char *template)
|
|
{
|
|
int i;
|
|
struct timespec ts;
|
|
unsigned long r;
|
|
|
|
__clock_gettime(CLOCK_REALTIME, &ts);
|
|
r = ts.tv_nsec*65537 ^ (uintptr_t)&ts / 16 + (uintptr_t)template;
|
|
for (i=0; i<6; i++, r>>=5)
|
|
template[i] = 'A'+(r&15)+(r&16)*2;
|
|
|
|
return template;
|
|
}
|
|
|