Hello,
I have a question regarding image randomization.
In my questionnaire, participants are asked to rank a number of randomized images. There is one image per page with two questions attached under it. The questions are the same for every image. Each image should only be shown once to each participant. I also want to break up the image pages with another page after every nine image pages, asking the participant if they'd like to rate another set of 9 images or go to the end of the questionnaire. The page order should look like this: 9 pages with one random image on each > "continue?" page > 9 pages with one random image on each > "continue?" page > 9 pages with one random image on each and so forth until all images have been rated. When I try to achieve this, the same 9 images are shown in each "section" of images (the 9 images differ between participants, so the randomization is at least working partly). This is what I've done:
First, I created a random generator. All images have been entered in the "code" column, and all images have received a corresponding code. The number of codes drawn per interview is the same number as the total number of images. "Type of drawing" is set to "equally distributed". This seems to be working, as the "drawn yet" column shows that each code is drawn once per interview. All the variables look fine.
I've then added the random generator to each image page (I suspect this is where the problem comes from), and looped each page 9 times. The page order in "compose questionnaire" looks like this: image page > "continue?" page > image page > "continue?" page > image page (and so on). Each image page also has PHP code based on this template:
// loopPage(20) provides a number between 0 and 19 (plus one at every repetition)
$i = loopPage(20); // Here you can enter the number of images you want to show
// Show the chosen picture
$varID = 'ZG03x'.sprintf('%02d', $i + 1); // Variable IDs are ZG03x01 to ZG03x20
$img = value($varID, 'label');
// The HTML-Tag <img> shows one image, the filename will be shown with src
html('
<div style="margin: 3em; text-align: center">
<img src="'.$img.'" alt="" />
</div>
');
// Create the fitting question ID and show the question using question()
question(id('AB', $i + 1)); // Question IDs AB01 to AB20
There are 2x9 question ID:s for every page, and the referenced sections are different for every page (but the actual questions are identical).
What should I do to fix the problem, and make sure each image is only shown once per participant but still randomized and regularly intercepted with a "continue?"-page? If I make several identical random generators there is a risk that the same image will be shown more than once to a single participant. If I divide the total number of images between several random generators, the 9-image sections would still be in the same order for all participants, even if the order of the 9 images within the sections would be randomized. Is there a way to randomize the order of the sections as well? That would mitigate the problem.
I don't have experience with any kind of code, so very clear answers would be much appreciated!