Source URL: https://docs.surveycto.com/02-designing-forms/03-advanced-topics/01.randomizing.html
Last updated: 2024-03-27
Randomizing survey elements
You can easily randomize the order of choices presented in any select_one or select_multiple question. Just include the "randomized" appearance (or something more advanced like "randomized(0, 1)" to randomize all choices except for the top 0 and bottom 1, which you'd want to do, e.g., if you had an "Other" option that you wanted to keep fixed at the bottom).
In the form designer, scroll down to the appearance section when adding or editing any select_one or select_multiple field, and check the "Automatically randomize choice order" option.
You can also generate random numbers in your form and use those random numbers to influence which questions or groups of questions appear. In SurveyCTO, random draws are always between 0 (inclusive) and 1 (exclusive), drawn from the uniform distribution – so there is, for example, a 50% chance that a given draw will be between 0 and 0.50.
In the form designer, click to + Add hidden field, select calculate as the field type, and click Configure. Next, give your random-number field a name, click Specify with a wizard for the calculation, and select Generate a random number. You can then refer to that field, for example, in another field or group's relevance conditions.
In the spreadsheet form definition, add a calculate field with "once(random())" in its calculation column. For example, you might have a calculate field named randnum1 with the calculation expression "once(random())". Once you have drawn a random number, you can then refer to it in your relevance expressions (e.g., "${randnum1} <= 0.50").
For a working example, see Randomization: Randomizing form elements.
Click here to learn how to randomize the section order of your forms.