Create a Password Generator in C++

You may simply create a password generator in C++ with the next easy technique.

create the Password Generator in C++#

#embrace <iostream>
#embrace <string>
#embrace <algorithm>
#embrace <random>

std::string generate_password(int size = 16) {
    std::string seed = string("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") + string("0123456789") + string("[email protected]#$%^&*()_+=-{}[]|:;<>,.?/");

    std::string password_string = seed;
    std::shuffle(password_string.start(), password_string.finish(), std::mt19937{std::random_device{}()});
    return password_string.substr(0, size);

int essential() {
    std::cout << generate_password() << std::endl;
    std::cout << generate_password(28) << std::endl;
    return 0;