Limesurvey offers various randomization features. One common randomization use case is showing different versions of a question at a Limesurvey survey. To do so, you need to randomly show one of the X question versions to the user so the first step would be to generate a random number between 1-X. For this we can use the powerful Limesurvey Expression Manager which is available since release 1.92.
The new question type “equation” can be used to store the result of the random function. So create an “equation” question with question code “randnumber” and the following content at the question text field, which will generate a random number between 1 and 2:
The whole code basically means that the system should first check if the rand variable was already populated. If it is still empty, a random number between 1 and 2 is created. Else, the already created number is kept and no new random number gets created.
If you want to hide the question from the user, set “Always hide this question” to “yes” at the advanced question settings.
Now we have a question that will be filled with either “1” or “2”, we can use conditions at following questions to show version A or version B of a question. For this you can use the Limesurvey condition manager and set a condition based on a constant value of 1 or 2 for the equation question. Alternatively you can use the “relevance” field to define when a question should be shown. The appropriate relevance reads:
…and for the second question:
Don’t forget to check if you set up everything correctly by having a look at the survey logic file.
…and if this still sounds too tricky, we can set up the survey for you.