Index: questiontype.php =================================================================== RCS file: /cvsroot/moodle/moodle/question/type/match/questiontype.php,v retrieving revision 1.63 diff -u -r1.63 questiontype.php --- questiontype.php 21 Sep 2010 08:20:48 -0000 1.63 +++ questiontype.php 26 Sep 2010 16:39:46 -0000 @@ -480,7 +480,15 @@ * calculate. */ function get_random_guess_score($question) { - return 1 / count($question->options->subquestions); + $answers = array(); + // Prepare a list of answers, removing duplicates. + foreach ($question->options->subquestions as $subquestion) { + $answertext = strip_tags(format_string($subquestion->answertext, false)); + if (!in_array($answertext, $answers)) { + array_push($answers, $answertext); + } + } + return pow(1 / count($answers), count($question->options->subquestions)); } /// RESTORE FUNCTIONS /////////////////