I'm using Java for this problem. Does anyone know how to randomly take 2 questions out of 3 question String array? Lets say I have a 3x5 string array like this:
String TestBank[][] = {{"What color is grass?","A. Green","B. Red","C. Pink","A"},
{"Whats the first month called?","A. December","B. January","C. March","B"},
{"What shape is a soccer ball?","A. square","B. flat","C. round","C"}};
The first column is the question, 2nd-4th column is the answer choices, and the 5th column is the correct answer. I'm trying to figure out how to randomly get 2 questions from these 3 and store those 2 questions into a one dimensional array of 2 rows in which we use the JOptionPane, for outputting, in which takes those questions from the one dimensional array and shows each question separately one by one in different windows with the answer choices included. And after answering the 2 questions, it tells the user the score based off how many questions he/she missed.
I'm relatively new to Java and it would be greatly appreciated if someone could help me with this.
Random'snextInt(int n). Have a look at the api link