Difference between revisions of "Randomize answer options/sub questions"
(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...) |
|||
Line 1: | Line 1: | ||
− | == | + | == 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 |
− | + | === Randomize answer options === | |
− | + | '''Example''' | |
− | + | *I have a single question with drinks as answer options. | |
− | + | [[Image:QuestionTips Rotate 1.jpg]] | |
− | + | *I want to show the answer options in random order (except None of the above option) | |
− | + | [[Image:QuestionTips Randomize 2.jpg]] | |
− | + | '''Solution''' | |
− | + | Use any random seed and a randomization range from 0 to 5 | |
− | <source lang="javascript | + | |
+ | '''Code''' | ||
+ | |||
+ | *Add a Single question to Questionnaire editor | ||
+ | *Go to menu Properties -> Question scripts -> Java script and input below script | ||
+ | |||
+ | <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> | ||
+ | |||
+ | === Randomize sub questions === |
Revision as of 11:01, 5 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: quest.randomizeAnswerOptions(randomSeed, startIndex, endIndex): randomize answer options in a range specified by startIndex and endIndex, the order is unique for each randomSeed