I am making a basic word scrambling and guessing game. To make sure the same word doesn't appear again (example words used) I need to delete the selected word. I have looked all over for solutions however none have worked. Any help is appreciated!
//word bank
string[] wordBank = {
"iphone", "airpods", "laptop","computer","calculator","ram","graphics", "cable","internet","world wide web"
};
//select random word
Random wordRand = new Random();
int index = wordRand.Next(wordBank.Length);
string wordSelect = wordBank[index];
//delete word so can't be used again
List<T>yet, so you might wish to avoid using it. Consider instead a strategy where you: keep a count of the numberOfWords (e.g. starts at 10), pick a random index between 0 andnumberOfWords-1(pick an index between 0 and 9) - suppose your random index is 4, pull the word out at index 4 ("calculator"), copy the word at indexnumberOfWords-1over the top of it (so 4 is now "www"), and reduce the numberOfWords by 1, return the word pulled out ("calculator"). Next time random will choose from 0-8..