Uniform distribution in Random-Trigger

 

English | Deutsch


If you use a Random-Trigger with a uniform distribution and you have infinite participants the query for the trigger is very complex, because it runs through all participants.
As a consequence the installtion will be very slow, participants will be rejected from your survey and the trigger loads for ever.

Instead of using a Random-Trigger -> Work with user-defined-variables + Recoding-Trigger and Modulo(mod)


What is Modulo?


Modulo (mod) is a mathematical function that names the remainder by dividing two integers.
Example: 10 mod 3 = 1 (10:3 = 3 -> rest 1) 
14 mod 5 = 4 (14:5 = 2 -> rest 4)
16 mod 3 = 1 (16:3 = 5 -> rest 1)

Solution:
Recoding-Trigger with LFDN and Mod

What is  lfdn?
Every participant has a unique lfdn (participants consequente number). If you use this number with mod you create also a random trigger with a uniform distribtution.

Setup uniform distribution for numbers 1-5

  1. Setup User-defined-variables (Project properties -> user-defined-variables -> Number of user-defined-variables: 1)

  2. Jump to the page where you wanna setup your random uniform distribution

  3. Create Recoding Trigger (Suvey-Menu -> Questionnaire-Editor -> Page-> Trigger -> Recoding-Trigger)


Settings of the Trigger:

Detail configuration:

Variable to be recoded: c_000x

Value: MOD(#lfdn# , 5 ) + 1

For 6 Random-numbers use 6 instead of 5..
If you wanna see the values of the lfdn and c_000x (user-defined-variable) use the following code in the questionnaire text or where you want


© 2024 Tivian XI GmbH