Overview
This article explains how to create a uniform distribution in RandomTrigger using userdefined variables, RecodingTrigger, and the Modulo function. It provides an alternative solution to overcome the limitations of using a RandomTrigger with infinite participants.
Information
The article focuses on implementing a uniform distribution for random triggering in surveys, particularly when dealing with a large number of participants. It introduces the concept of Modulo and explains how to use it with userdefined variables and RecodingTrigger to achieve the desired result.
Understanding the Problem
When using a RandomTrigger with a uniform distribution and infinite participants, the query for the trigger becomes very complex. This complexity leads to several issues:
 The installation process becomes very slow
 Participants may be rejected from the survey
 The trigger takes an excessive amount of time to load
To address these problems, an alternative approach using userdefined variables, RecodingTrigger, and the Modulo function is recommended.
Introduction to Modulo
Modulo (mod) is a mathematical function that returns the remainder when dividing two integers. For example:
 10 mod 3 = 1 (10 divided by 3 equals 3 with a remainder of 1)
 14 mod 5 = 4 (14 divided by 5 equals 2 with a remainder of 4)
 16 mod 3 = 1 (16 divided by 3 equals 5 with a remainder of 1)
Implementing Uniform Distribution
To implement a uniform distribution for random triggering, follow these steps:
Solution:
RecodingTrigger 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 15

Setup Userdefinedvariables (Project properties > userdefinedvariables > Number of userdefinedvariables: 1)

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

Create Recoding Trigger (SuveyMenu > QuestionnaireEditor > Page> Trigger > RecodingTrigger)
Settings of the Trigger:
Detail configuration:
Variable to be recoded: c_000x
Value: MOD(#lfdn# , 5 ) + 1
For 6 Randomnumbers use 6 instead of 5..
If you wanna see the values of the lfdn and c_000x (userdefinedvariable) use the following code in the questionnaire text or where you want
FAQ
What is lfdn?
lfdn stands for "laufende Feldnummer" in German, which translates to "consecutive field number" in English. Every participant has a unique lfdn, which is essentially a participant's consecutive number. By using this number with the Modulo function, you can create a random trigger with a uniform distribution.
Why is this method better than using a RandomTrigger with infinite participants?
This method using Modulo and RecodingTrigger is more efficient because it avoids the complexity of running through all participants, which can cause slow installation, participant rejection, and long loading times for the trigger. It provides a simpler and faster way to achieve a uniform distribution for random triggering.
Comments
0 comments
Article is closed for comments.