LimeSurvey random number seems to change on export
Hi everyone,
I’m dealing with a strange issue in LimeSurvey related to randomization and conditions, and I’d really appreciate some insight.
In my survey, I assign participants to conditions using:
- {rand(1,2)} to generate a random number
- (condition == 1) and **(**condition == 2) to display the corresponding blocks
During the survey, everything appears to work correctly: participants see the right condition and answer accordingly.
However, when I export the data, the value stored for the random number sometimes doesn’t match the condition the participant actually saw. I tested it myself: I noted the condition I was assigned during the survey, but in the exported dataset the number is different, as if LimeSurvey generated a new random number instead of saving the original one.
What makes this even more confusing is that the issue is not consistent.
Some participants have the correct random number in the export, and they also pass all attention checks. Others show a mismatch.
Since the survey is already active and collecting data, I would strongly prefer a solution that allows me to fix the issue by changing only the code, without restructuring the survey or restarting data collection.
My main question is:
Is there a reliable way to store the random number as a fixed value (e.g., via an equation question or hidden field) so that {rand(1,2)} doesn’t get recalculated later?
Any suggestions or best practices would be extremely helpful. I need to analyze condition-wise data, but right now the exported values aren’t always trustworthy.
Thanks in advance!