I have around 1000+images and I want to perform the randomization over these images on Qualtrics such that only one image appears whenever someone takes survey. Could anybody guide me through this as I do not have any background in Java script.
I have prepared the following code, this code consist of image id's in an array. The function random generates a random number based on the total number of image id's in the array. This number would use to select one image out of the array. Then this image would be appended with the web link. However, am not sure the logic of this code is correct or not. It would be helpful if somebody could take look at this, as I am new to java scripting
Qualtrics.SurveyEngine.addOnload(function()
{var currentQuestionID = this.getQuestionInfo().QuestionID;
var arr1=[IM_agGu9Te6eP0pjN3,IM_79ZbXlCrr1iRXNz,IM_2i5fyTch,IM_5uxw4IrD0TMupmt,IM_5dNoMSOmYDRVBOJ]
function randomImage()
{
var idx = Math.floor(Math.random()*MAX_PLUS_ONE);
return images[idx];
};
var image1 = randomImage();
image1.style.display = 'https://az1.qualtrics.com/ControlPanel/Graphic.php?IM= 'imgae1