samedi 8 janvier 2022

How to randomly repeat variables/ survey questions multiple times

I created different trials/survey questions. They need to be displayed one at a time. But, they need to be presented in a random order and multiple times and I have no idea how to do this.

The survey questions are created like:

var trial_one = {
  type: 'survey-multi-choice',
  questions: [
    {
      prompt: "Question", 
      name: 'Whatanswer', 
      options: ['answer1', 'answer2'], 
      required: true
    }, 
  ],
};

and I have multiple of these trials. But I am looking for a way to create a timeline in which each of these trials is repeated X times in a random order. I have tried to make the trials into an array and use code to randomize this array and repeat it X times, but that doesn't work.

I do know that within this type (survey-multi-choice) I can create multiple questions and randomize that order, but then they would be displayed on the same page, which is not what I want.




Aucun commentaire:

Enregistrer un commentaire