Hi,
there are some misunderstandings.
1. rand(1,9)
As you saw this function generates ONE random number between 1 and 9.
Now you could think "Oh, I just generate three random numbers 1-9". But here you might get 4, 7, 4 - doubles.
So this approach is not usable.
2. shuffleArray([1,2,3,4,5,6,7,8,9])[1]
Where did you find this function? It is not an implementd function of LimeSurvey.
These you find here
[url]
www.limesurvey.org/manual/ExpressionScri...mplemented_functions
[/url]
Well, now the solution(s)
1. If you have rights to use javascript (unfortunately you did not answer the questions at the beginning) you create a question of type "short text" (eq1).
In the source code of this question you enter this script.
BTW: Here you find this function "shuffle"
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,7,8,9];
arr = shuffle(arr).slice(0,3).join('');
$('#question{QID} input[type="text"]').val('#' + arr);
$('#question{QID}').hide();
});
</script>
You will get something like
And now you have the condtions of your groups.
group1 is displayed if this string contains "1"
group2 is displayed if this string contains "2"
group3 is displayed if this string contains "3"
...
To check you use the function strpos(haystack,needle)
So.
group1: strpos(eq1,"1")>0
group2: strpos(eq1,"2")>0
group3: strpos(eq1,"3")>0
...
Why did I add the heading "#".
Without this the result of strpos("241","2") would be 0 (strpos starts counting at 0).
But a result of 0 also means "not found"
To avoid this there is the "#".
2. If you have no rights to use javascript you can do this with only ExpressionScript.
But this is a bit longer (you need 10 single equations), but really very straightforward.
If you need this solution, send the lss export of your survey , and I'll show.
Joffm