#include <iostream>
#include <cstdlib>
#include <ctime>
// Function to generate a truly random password
std::string generateRandomPassword(int length) {
const std::string characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_=+[]{}|;:'\",.<>/?";
const int numCharacters = characters.length();
// Seed the random number generator with the current time
std::srand(static_cast<unsigned int>(std::time(nullptr)));
// Generate random password
std::string password;
for (int i = 0; i < length; ++i) {
int randomIndex = std::rand() % numCharacters;
password += characters[randomIndex];
}
return password;
}
int main() {
// Specify the length of the password
int passwordLength = 12;
// Generate and print a random password
std::string randomPassword = generateRandomPassword(passwordLength);
std::cout << "Random Password: " << randomPassword << std::endl;
return 0;
}