Toggle menu
862
3.8K
30.2K
279.1K
Catglobe Wiki
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Randomize answer options/sub questions: Difference between revisions

From Catglobe Wiki
New page: == Challenge == In order to synchronize randomization of sub questions/answer options among several questions As a questionnaire creator I want to control the randomization with a rando...
 
Cg van (talk | contribs)
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Challenge ==
== Randomize answer options/sub questions  ==


In order to synchronize randomization of sub questions/answer options among several questions
In order to synchronize randomization of sub questions/answer options among several questions  


As a questionnaire creator
As a questionnaire creator  


I want to control the randomization with a random seed, which means that the system will generate a unique order based on one value of random seed
I want to control the randomization with a random seed, which means that the system will generate a unique order based on one value of random seed  


'''Example'''
=== Randomize answer options  ===


I have a single question with drinks as answer options.
'''Example'''


[[Image: QuestionTips_Rotate_1.jpg]]
*I have a single question with drinks as answer options.


I want to show the answer options in random order (except None of the above option)
[[Image:QuestionTips Rotate 1.jpg]]


[[Image: QuestionTips_Randomize_2.jpg]]
*I want to show the answer options in random order (except None of the above option)


== Solution ==
[[Image:QuestionTips Randomize 2.jpg]]


Use any random seed and a randomization range from 0 to 5
'''Solution'''


== Code ==
Use any random seed and a randomization range from 0 to 5
<source lang="javascript" line="1">
 
'''Code'''
 
*Add a Single question to Questionnaire editor
*Go to menu Properties -&gt; Question scripts -&gt; Java script and input below script<br>
 
<br>
 
<source lang="javascript">
quest.randomizeAnswerOptions(3, 0, 5);
quest.randomizeAnswerOptions(3, 0, 5);
</source>
</source>  
 
''{{note}} quest.randomizeAnswerOptions(randomSeed, startIndex, endIndex): randomize answer options in a range specified by startIndex and endIndex, the order is unique for each randomSeed''
 
<br> [[Image:RandomAnswerOptions.jpg]]
 
=== Randomize sub questions  ===
 
'''Example'''
 
*I have a single grid question with drinks as sub questions.
 
[[Image:RandomSubQuestions1.jpg]]
 
*I want to show the sub questions in random order
 
[[Image:RandomSubQuestions2.jpg]]
 
'''Solution'''
 
Use any random seed and a randomization range from 0 to 5
 
'''Code'''
 
*Add a Single question to Questionnaire editor
*Go to menu Properties -&gt; Question scripts -&gt; Java script and input below script
 
<br> <source lang="javascript">
quest.randomizeSubQuestions(3, 0, 5);
</source>
 
''{{note}}quest.randomizeSubQuestions(randomSeed, startIndex, endIndex):randomize sub questions in a range specified by startIndex and endIndex, the order is unique for each randomSeed''
 
<br> [[Image:RandomSubQuestions.jpg]]
 
=== Source  ===
 
Questionnaire Resource Id on cg site: 159730

Latest revision as of 04:25, 6 January 2012

Randomize answer options/sub questions

In order to synchronize randomization of sub questions/answer options among several questions

As a questionnaire creator

I want to control the randomization with a random seed, which means that the system will generate a unique order based on one value of random seed

Randomize answer options

Example

  • I have a single question with drinks as answer options.

  • I want to show the answer options in random order (except None of the above option)

Solution

Use any random seed and a randomization range from 0 to 5

Code

  • Add a Single question to Questionnaire editor
  • Go to menu Properties -> Question scripts -> Java script and input below script


quest.randomizeAnswerOptions(3, 0, 5);

Note Note: quest.randomizeAnswerOptions(randomSeed, startIndex, endIndex): randomize answer options in a range specified by startIndex and endIndex, the order is unique for each randomSeed


Randomize sub questions

Example

  • I have a single grid question with drinks as sub questions.

  • I want to show the sub questions in random order

Solution

Use any random seed and a randomization range from 0 to 5

Code

  • Add a Single question to Questionnaire editor
  • Go to menu Properties -> Question scripts -> Java script and input below script


quest.randomizeSubQuestions(3, 0, 5);

Note Note: quest.randomizeSubQuestions(randomSeed, startIndex, endIndex):randomize sub questions in a range specified by startIndex and endIndex, the order is unique for each randomSeed


Source

Questionnaire Resource Id on cg site: 159730