0 votes
ago in SoSci Survey (English) by s340755 (130 points)

Hello, I would like to ask a question with 16 possible answers and have the computer randomly select only 2 questions to ask the user. I've used the following PHP code :
$items = random_items('B019', 2);
question('B019', $items);
But with this code, I don't have the information: which two options were chosen at random. I only know which answer was chosen by the user.

How do I do ?

Thanks

1 Answer

+1 vote
ago by SoSci Survey (355k points)
selected ago by s340755
 
Best answer

Please use a random generator instead of the random_items() function.

You can tell it to draw 2 codes per interview, the code will look something like this:

show('RG01'); // Use the random generator
$items = array_values(valueList('RG01'));
question('B019', $items);

The random generator will not only store what items have been drawn, but it will also take care that each item is drawn equally often (unless you tell it something else).

ago by s340755 (130 points)
Thank you for your quick and precise answer ! This site is a massive help for my Master's degree ! Be blessed.

Willkommen im Online-Support von SoSci Survey.

Hier bekommen Sie schnelle und fundierte Antworten von anderen Projektleitern und direkt von SoSci Survey.

→ Eine Frage stellen


Welcome to the SoSci Survey online support.

Simply ask a question to quickly get answers from other professionals, and directly from SoSci Survey.

→ Ask a Question

...