#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void rand_string(char *str, size_t size) {
const char charset[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
for (int i = 0; i < size; i++) {
str[i] = charset[rand() % (int) (sizeof charset - 1)];
}
str[size] = '\0';
}
int main(void) {
char s[6] = "";
srand(time(0));
for (int i = 0; i < 10; i++) {
rand_string(s, 5);
puts(s);
}
return 0;
}
/*
run:
oKbJx
eDZaE
hsKYp
OThOD
ayByp
QZXIg
ZZSAi
sflth
SaBEb
qSuzI
*/