char charset[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+";
// int passwordLength = 10; // Change this value to set the desired length of the passwordchar generatedPassword[10 + 1];
int i;
lr_save_string("", "GeneratedPassword"); // Clear any previous values
// Generate random characters for the password
for (i = 0; i < 10; i++) {
int index = rand() % (sizeof(charset) - 1);
generatedPassword[i] = charset[index];
}
generatedPassword[10] = '\0'; // Null-terminate the string
lr_save_string(generatedPassword, "GeneratedPassword"); // Save the generated password as a parameter
lr_output_message("Random password: %s", generatedPassword);
No comments:
Post a Comment