I have this following code where is generated only a fixed string everytime that the program is executed, already tested in 2 computers and always is generated the same string. Then how generate a diferent string in each execution?
void gen_random(char *s, const int len) {
static const char alphanum[] =
"0123456789"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz";
for (int i = 0; i < len; ++i) {
s[i] = alphanum[rand() % (sizeof(alphanum)-1)];
}
s[len] = 0;
}
// int _tmain(int argc, _TCHAR* argv[])
char str[MAX_PATH];
gen_random(str, 10);