+ 2
Random elements from an array
I have a question. I'm trying to complete the password generator assignment and I don't know how to output a random element from an array. Can anyone help me? https://code.sololearn.com/chT9Fw0fw3Mr/?ref=app
4 Answers
+ 2
https://en.cppreference.com/w/cpp/numeric/random/rand
Hint: In your loop, generate a random number between 0 and the length of your char array, and use it to get a char from that array and print it.
+ 3
Ok thanks! but I would like to output random letters.
+ 1
+ 1
Thanks Zen