I'm trying to generate a random integer which is responsible for selecting information from the array given below, in this case it's supposed to get a question (1 to 5) and store it in the string.
But I can't seem to convert the random to int. Does anyone have suggestions on a possible solution?
Random rand = new Random().Next(1, 5);
int randNum = rand.Next(1, 5);
string questString = questions.GetValue(quest, randNum);
Your random object is wrongly initialized, calling the function Next(1, 5) will return an integer and not an instance of the random
you need to do
Random rand = new Random();
int randNum = rand.Next(1, 5);
string tekstvraag = vragen.GetValue(vraag, randNum);