Home > Uncategorized > How to: keep the same randomization order for several questions

How to: keep the same randomization order for several questions

Overview

A common requested scripting technique is to display a set of answers on screen in some randomized order. It could be there’re several questions with the same set of answers, where you would want to display that set of answers in a randomized order, yet in the same randomized order in each question.

This HowTo will show how this can handled.

 

1. Step 1: Create a Dummy Open Ended Question:

2. Step 2: Determine the randomized order

3. Step 3: Add the randomization code to all questions

 

 

Step 1: Create a Dummy Open Ended Question

 

Add an open ended question to the script, and set it to be hidden from surveyor.

The purposes of this question would be to save a string of the answers set indexes in the chosen randomized order:

 

Step 2: Determine the randomized order

 

Add the following code to the first question’s (out of the questions to display…) start script:

 

// create array of all answers indexes in a randomized order

var arr=CreateRandomArray(GetAnswerCount(CurrQues));

// set the string of the indexes randomized order in the dummy question

SetAnswer(QRef(1),IntArrayToString(arr));

 

 

 

Step 3: Add the randomization code to all questions

 

In all displayed questions’ start script, add this code:

RandomizeAnswers(CurrQues, StringToIntArray(Answer(QRef(1)).ToString()));

 

 

That’s it!

 

Visit us at:

Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s