Overview
This article explains how to draw two random numbers without replacement from a pool of numbers using EFS Survey. It covers the process of setting up user-defined variables, creating a static list, and using a list trigger to generate random selections.
Information
This guide focuses on the steps required to randomly select two numbers from a predefined pool using EFS Survey's features. It includes instructions for setting up the necessary components and executing the random selection process.
Setting Up User-Defined Variables and Static List
Example: There is a pool of numbers: 1, 22, 313, 414, 559 (subsequently called "pool“). Your goal is to draw two of them, randomly selected (random numbers).
Add two User-defined variables to your project: Survey menu >> Project properties >> User-definded variables: 2, save, Labels and Data type: set them to Integer, and name them, i.e. random1, random2 save.
Create a static list: Questionnaire editor >> Lists >> Create static list give a name, i.e. Pool save. Add as many list elements as there are elements in the pool, here: five. Inclusion condition: Always in random selection. Change list element no. accordingly to your pool numbers.
In the Questionnaire editor add a List trigger at a point before the random numbers are needed: Triggers >> give a name, i.e. random numbers, activate: List trigger, click on button: Create. Settings of trigger: Also execute trigger in preview mode: activate, (other settings according to individual needs) save. Detail configuration: Select your list: Pool Add two New List Elements:
List element List Property Target variable
List element 1 Label random1 (c_0001)
List element 2 Label random2 (c_0002)
List options: activate (!) the radio button and insert a 2 in the line „list elements will be selected at random.“activate: Randomize list elements. Save.
Now you have two randomly selected numbers from your pool in the variables c_0001 and c_0002.
General Information and Limitations
- This example is for selecting 2 random numbers. For more numbers, create additional user-defined variables and extend the list trigger accordingly.
- You can increase the pool by adding more list elements to your static list.
- The maximum number of elements in the pool is limited to 250 (maximum static list size).
- Numbers in the pool can be negative if using the Label property.
- You can use element numbers instead of labels by choosing "Element Number" in the list trigger, but these are limited to 999.
FAQ
Can I select more than two random numbers?
Yes, you can select more than two random numbers by creating additional user-defined variables and extending the list trigger configuration accordingly.
What is the maximum size of the number pool?
The maximum size of the number pool is 250, which is the limit for a static list in EFS Survey.
Can I use negative numbers in the pool?
Yes, you can use negative numbers in the pool if you are using the Label property in the list trigger configuration.
Comments
0 comments
Article is closed for comments.