> version 2&3 are exactly the same except the 10 questions
Then simply put the IF there.
if (!isset($questions1)) {
if (value('RG02') == 1) {
$questions = array('E101', 'E102', 'E103', 'E104', 'E105', 'E106', 'E107', 'E108', 'E109', 'E110', 'E111', 'E112', 'E113', 'E114', 'E115', 'E116', 'E117', 'E118', 'E119', 'E120', 'E121', 'E122', 'E123', 'E124', 'E125', 'E126');
} elseif (value('RG02') == 2) {
$questions = ...
} else {
$questions = ...
}
// shuffle list randomly
shuffle($questions);
// cache rotation in case page is repeated
registerVariable('questions');
}
That was the second-best. The best solution would be even easier. Given your random generator with all the questions is configured to draw 26 questions per respondent. Instead of all the above stuff, you would simply write
$questions = valueList('RG02', null, 'label');
$i = loopPage(count($questions));
question($questions[$i]);
Really, that's all.