Hi Animikh,
I can not think of a way to do this but maybe I'm missing something. It
is very easy to have the student get a different set of questions each
time they click submit (i.e. to get "the random number to be generated
afresh every time a student clicks"), but this is not what you want
(see below). To get a new random number each time just add e.g.
TEXT(&beginproblem);
$PG_random_generator->srand(time);
so that perl's time function seeds the random number generator. However, the grading of the problem doesn't work.
What is going on is the following. WeBWorK produces and displays a
problem (with random data fixed by the seed) and that's the end of the
process. The student submits an answer which creates a new process
which produces a "new" problem, checks that the student's answer is a
correct answer to the problem, and then displays the problem. If the
new problem has a different seed than the original problem, then the
student's answer to the original problem will be checked against the
correct answer to the new problem and will almost always be wrong.
In theory one could get the seed from the database, create but not
display the problem, check the student's answer, then create and store
a new seed and create and display a new problem based on the need seed.
But WeBWorK doesn't work that way (it would double the necessary work).
Arnie
<| Post or View Comments |>
|