1. on start of the layout, set your array to 1, 2, 3... till the number of your questions.
2. then use function to set random number from(1-end) to show a random question.
3. if the answer is correct, change the value to "solved"
then, to generate a new question, call the function again, but if array index-X has been solved, call the function till you find an unsolved question.
this is not the best method, but I hope you can get an enlightment from this.
sorry for my bad english.