In my questionnaire, I have two modules where I will randomize the questions. The first one involves using syntaxes (expressions) to randomly order three choice sets (each choice set contains 6 options to choose). Below is the expression used to order the choice sets randomly:
long Integer called random_tp
(int)Math.Floor((7-1)*Quest.IRnd() + 1)
The second is about creating a macro to choose one question out of 5. This section will ask respondents about their willingness to pay for insurance in which there are 5 prices that should be picked up randomly (see below the 5 options of WTP).
[WTP] is randomly selected by Field Supervisor from the following list:
- PEN 2.50 (US$ 0.65)
- PEN 15.00 (US$ 3.87)
- PEN 25.00 (US$ 6.45)
- PEN 50.00 (US$ 12.91)
- PEN 125.00 (US$ 32.27)
Could somebody help in creating the macro, please? Below is my attempt but I failed so far:
var r = ((int)Math.Floor(rndum.Value*5.00) + 1)Quest.IRnd();
var s = r.ToString(“0.0000000000”);
var items = new[1,2,3,4,5]{
“wtp1_1”,
“wtp2_1”,
“wtp3_1”,
“wtp4_1”,
“wtp5_1”};
for (var i = 0; i < items.Length; i++)
{
var n = Convert.ToInt32(s.Substring(i,1));
if (n >= items.Length) n = 0;
var t = items[i];
items[i] = items[n];
items[n] = t;
}
return items
This results in showing the 5 questions as opposed to choosing one question out of 5.
I am using expressions and a macro to make sure the randomization is not correlated in both modules.
Any help is worth it!
Thank you