Well,
so again explained.
You use a question of type "equation" to
- create a new variable and fill it
- assign a calculated value to another variable
You do the first.
If you create a question of type "equation" the calculated value of the equation is stored in the database in column "[questioncode]"
Example:
A question with questioncode "ABCD" and this questiontext {sum(1,sqrt(9))} will store "4" in variable "ABCD".
All function you find here
[url]
www.limesurvey.org/manual/ExpressionScri...mplemented_functions
[/url]
Exactly this you do to create your random number.
Create a question of type "equation" (let's call it "randnbr") and enter the shown function
{if(is_empty(randnbr),rand(1,4),randnbr)}
Why do we recommend this construct?
As you can easily reproduce in Excel the random number changes with every mouse click in the page.
So if the question to generate the random number is inside a group with other questions the number is changed each time the respondent clicks.
Or if it is possible to go back in the survey and the question is touched again.
Therefore this IF: IF the random number is still empty fire the function "rand(x,y)", otherwise let the number as it was.
This structure of the IF is the same as in Excel.
As I wrote before this generated random number is stored in variable "randnbr".
It is a good idea to activate a survey, enter some well defined data and have a look at the answer table.
You get a lot of insight how variables are called and how data are stored.
Afterwards you stop the survey again.
And now the distribution of your respondents.
You know about "relevance equation" resp. "condition". The wording depends on your version of LimeSurvey.
Unfortunately you ignored the initial questions. The are not asked just for fun.
This "condition" is logical term that is either TRUE or FALSE.
If TRUE the group/question/subquestion is displayed, if FALSE not.
Now in the field "relevance equation" / "condition" of your four groups you enter the condition to show it.
In group 1: randnbr==1, meaning: If the generated random number (randnbr) is equal 1 the condition is TRUE -> the group is displayed, otherwise it is hidden.
In group 2: randnbr==2
In group 3: randnbr=
In group 4: randnbr==4
This group level relevance you may study in one of the sample surveys
[url]
www.limesurvey.org/manual/ExpressionScri...eys/en#Sample_Census
[/url]