Is there a function that randomly shuffles up an array?
Say I make a char array with the alphabet in it, and I want it to randomly print Letters from the char array. Thanks!
#include <iostream>
#include <algorithm>
int main() {
char alphabet[26];
for ( int i = 0; i < 26; ++i )
alphabet[i] = i + 'a';
std::random_shuffle(alphabet, alphabet+26);
for ( int i = 0; i < 26; ++i )
std::cout << alphabet[i] << ' ';
return 0;
}