public void generateQuestion() { int numberOfQuestionTypes = questionList.Count; int selectedType = RandomGen.next(numberOfQuestionTypes); QuestionFactory factory = questionList[selectedType]; while (previousQuestionFactory != null && factory.GetType().Equals(previousQuestionFactory.GetType())) { selectedType = RandomGen.next(numberOfQuestionTypes); factory = questionList[selectedType]; } previousQuestionFactory = factory; Question question = factory.getQuestion(); this.currentQuestion = question; question.loadQuestion(); time = 0f; }