Generating Random keys

I am trying to generate a key from a given functions made by me, but I want to add randomize algorim without repetition similar as I do in python using secrets , but how can I do it in c++? my variable seq which store one , two , three, four , but once I want to concatenate my functions to generate my key if I change to std::vector<std::string my t it return an error of std::basic

int main(){
	std::vector<std::string> seq{ "One", "Two", "Three", "Four" };
	std::string t = reverse.ascii_lowercase() + reverse.ascii_uppercase() + reverse.digits() + reverse.punctuation();
	std::cout << reverse.join(seq, "--") << std::endl;
	std::cin.get();
}
t = string.ascii_lowercase + string.ascii_uppercase + string.digits + string.punctuation
key = ''.join([secrets.choice(t) for _ in range(20)])

have you tried using srand(time()) ?

is there a way to implement mt19937 ?

if you add the c++11 flag to the compiler

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.