Hi, lobster,
1. with javascript
create a question of type "short text" and enter this snippet
Code:
<script type="text/javascript" charset="utf-8">
function shuffle(array) {
var currentIndex = array.length, temporaryValue, randomIndex;
// While there remain elements to shuffle...
while (0 !== currentIndex) {
// Pick a remaining element...
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex -= 1;
// And swap it with the current element.
temporaryValue = array[currentIndex];
array[currentIndex] = array[randomIndex];
array[randomIndex] = temporaryValue;
}
return array;
}
$(document).on('ready pjax:scriptcomplete',function(){
// Fill the array
var arr = [1,2,3,4,5,6];
arr = shuffle(arr);
anumbers = arr.slice(0,3).join('');
$('#question{QID} input[type="text"]').val("#"+anumbers);
$('#question{QID}').hide();
});
</script>
You will get a string like
Now you can display your groups using the relevance equation:
group 1: strpos(Q1,"1")>0
group 2: strpos(Q1,"2")>0
...
Now you see the reason for the "#": To be able to distinguish between the index "0" and the result "0", meaning "not found".
2. Without javascript
There are only 20 different combination of 3 groups out of 6.
1: 1,2,3
2: 1,2,4
3: 1,2,5
4: 1,2,6
5: 1,3,4
6: 1,3,5
7: 1,3,6
8: 1,4,5
9: 1,4,6
10: 1,5,6
11: 2,3,4
12: 2,3,5
13: 2,3,6
14: 2,4,5
15: 2,4,6
16: 2,5,6
17: 3,4,5
18: 3,4,6
19: 3,5,6
20: 4,5,6
Create a random number 1-20 and display the groups accordingly.
Group 1: random<11
Group 2: (random<5) OR ((random>10) AND (random<17))
Group 3: (random==1) OR ((random>4) AND (random<

) OR ((random>16) AND (random<20))
...
Joffm