Hi, Jessica,
first the basics.
If you read in the manual about implemented functions
manual.limesurvey.org/Expression_Manager...mplemented_functions
you see that the function
rand(x,y) creates a random number between x and y.
And you know that in Expression Manager there are curly brackets around a formula.
And the randomization?
Question of type equation (let's call it "eqRandom")
In the question text {if(!is_empty(eqRandom),eqRandom,rand(1,2))}
Explanation: Depending on the structure of your survey the function "rand" might be fired more than once (e.g. if respondents are allowed to go back) and change the value. Therefore this function is only fired if the value of the equation is still empty; else the value is kept.
This is the same as in EXCEL.
To avoid this, we use this construct:
{if(!is_empty(eqRandom),eqRandom,rand(1,2))}
Here the question code of our random number equation is "eqRandom".
And the meaning is:
if(!is_empty(eqRandom),: IF the random number is not empty,
eqRandom: keep the already calculated random number
rand(1,2): ELSE use the function "rand" to calculate one.
The if-statement also is explained in the above link "implemented functions".
Now your scenario:
First you create your question of type equation (let's have it the question code "rnumber")
Here you enter the above explained
{if(!is_empty(rnumber),rnumber,rand(1,3))}
And in the relevance equation of your three GROUPS you enter in
test2 - Group1: rnumber==1
test2 - Group2: rnumber==2
test2 - Group3: rnumber=
That's all.
Here an example.
It is nearly the same that I attached to Steffi's question, but adapted to your scenario.
Joffm