Quantcast
Channel: Indigo Rose Software Forums - Forums
Viewing all articles
Browse latest Browse all 2105

How Do I Stop Randomization of Quiz

$
0
0
Im interested in the Quiz Template found in AMS, but how do i stop the quiz from populating the questions in a random format? here is the Random Section of the sample code;

-- Now we can build a random quiz
tbRnd = {}

--Build a temporary table counting from 1 to the total number of questions
local tbQtA = {} for x = 1,nTQ do

tbQtA[x] = x; end

--Define a random seed to help randomize the quiz
seed_time = System.GetTime(TIME_FMT_SEC)..System.GetTime(TIME_ FMT_MIN)..System.GetTime(TIME_FMT_HOUR);
seed_input = seed_time..System.GetDate(DATE_FMT_JULIAN); Math.RandomSeed(seed_input);

--The following actions will build a table that contains a list of random questions
--This table will then define the quiz to be taken.

while Table.Count(tbRnd) < nQtA do

--Generate a random number
local nRnd = Math.Random(1,Table.Count(tbQtA));

--Extract this random number from our number of questions table
--Table remove will capture the line item and remove it from our temporary table
--that way we will not have duplicate questions asked

local nQ = Table.Remove(tbQtA, nRnd);

--Insert the random question to our table
Table.Insert(tbRnd, Table.Count(tbRnd)+1, nQ); end

Viewing all articles
Browse latest Browse all 2105

Trending Articles