Hi,
I want to show 40 pictures with names to the participants. The order of the pictures and the pairs (picture + name) need to be randomized. At the moment I have each picture as a single question randomized with question randomization. I put the names in Javascript (I`m totally new to Javascript) and they are drawn randomly. But the names can not be drawn completely random as I have two lists of names and want certain pictures to be paired with any (random) name from list 1 but not list 2 and the other way around. In addition to that I need each name to be assigned to one picture just once. How can I achieve this? What code do I need to use?
Thank you so much already!
So far I`ve used this code:
Qualtrics.SurveyEngine.addOnReady(function() {
var words = ["Thomas", "James", "Tom", "Daniel"]; //Your words
var i = Math.floor(Math.random() * words.length); //randomly select an index
var my_word = words[i]; //select a word
Qualtrics.SurveyEngine.setEmbeddedData( 'word', my_word); //Send the word to the Qualtrics output, otherwise you would not know which participant get which word
document.getElementById("random").innerHTML = my_word; //show the word to respondents
});
Question
Javascript - assign names randomly from 2 lists
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
