4 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetQuestion.php';
28 $this->questions[] = $question;
33 return count($this->questions) > $amount;
38 return count($this->questions) < $amount;
43 return $amount - count($this->questions);
48 shuffle($this->questions);
53 $this->questions = array_merge( $this->questions, $questionCollection->getQuestions() );
58 $uniqueQuestions = array();
64 if( !isset($uniqueQuestions[$question->getQuestionId()]) )
66 $uniqueQuestions[$question->getQuestionId()] = $question;
70 $uniqueQuestionCollection =
new self();
71 $uniqueQuestionCollection->setQuestions($uniqueQuestions);
73 return $uniqueQuestionCollection;
78 $questionIds = array_flip( $questionCollection->getInvolvedQuestionIds() );
80 $relativeComplementCollection =
new self();
84 if( !isset($questionIds[$question->getQuestionId()]) )
86 $relativeComplementCollection->addQuestion($question);
90 return $relativeComplementCollection;
95 $questionIds = array();
99 $questionIds[] = $question->getQuestionId();
109 $randomQuestionCollection =
new self();
111 foreach($randomKeys as $randomKey)
113 $randomQuestionCollection->addQuestion( $this->questions[$randomKey] );
116 return $randomQuestionCollection;
128 return array_rand($array, $numKeys);
131 return array( array_rand($array, $numKeys) );