RandomSingleFromList
Description:
script:RandomSingleFromList(RangeStart,RangeEnd,RangeCount,Seed,Item)
Pick a single random number from a list for random generated numbers. To be used when you want a series of "unrelated" random numbers, where you then can pick one by one of these to be used in various questionnaire logic. The function first creates a list of random numbers and then return the one you selected from the list.
Parameters:
This function has exactly 5 parameters:
- RangeStart
- Specify the lowest possible random number you want created in the list
- RangeEnd
- Specify the largest possible random number you want created in the list
- RangeCount
- Specify the number of random numbers you want created in the list (this number should be less than the interval defined by the RangeStart-RangeEnd
- Seed
- Specify a seed to be used for the random generater. Typically you will use the "sys_random" variable that is a random number between 0 and 1000 created at the start of an interview. This will ensure that the list of random numbers will the same for one given respondent.
- Item
- Specify the item you want returned from the list
Example:
script:RandomSingleFromList(1,1000,10,\@sys_random,5)
This will generate a list of 10 random numbers between 1 and 1000, using sys_random as seed, and return the 5th item in the list. If the list is "311,451,486,506,539,639,738,871,903,963" the 5th item is "539".