I'm very new to C++ and have a pretty daunting assignment due this week. I won't get into too much detail about it as I don't want work done for me, but can anyone point me in the right direction as to how I would go about picking random characters from a multi-dimensional string array?
char gameZero[16][6] = { {'A','A','C','I','O','T'}, {'A','H','M','O','R','S'}, {'E','G','K','L','U','Y'}, {'A','B','I','L','T','Y'}, {'A','C','D','E','M','P'}, {'E','G','I','N','T','V'}, {'G','I','L','R','U','W'}, {'E','L','P','S','T','U'}, {'D','E','N','O','S','W'}, {'A','C','E','L','R','S'}, {'A','B','J','M','O','Q'}, {'E','E','F','H','I','Y'}, {'E','H','I','N','P','S'}, {'D','K','N','O','T','U'}, {'A','D','E','N','V','Z'}, {'B','I','F','O','R','X'} };
The goal is to print out a 4x4 board of these characters, picking one random character from each array at the start of every game so not one board is the same.
Any advice/tips on how to do this would be greatly appreciated-- thank you!
EDIT:
I have gotten to a point where I can generate a random indices from both arrays, however the current way I am doing it only outputs one character, whereas I need ONE char from each of the 16 assortments within the array. Any ideas on how I can output one from each? I'd imagine I have to put the index generators inside some sort of loop.
mt19937 gen(time(nullptr)); // random number generator
// used to generate random number in specific range
uniform_int_distribution<int> random_outer(0, outer_size - 1);
uniform_int_distribution<int> random_inner(0, inner_size - 1);
int index_outer = random_outer(gen); // used to generate random outer index
int index_inner = random_inner(gen); // used to generate random inner index
cout << gameZero[index_outer][index_inner] << endl;