WeBWorK Main Forum

uniform seeds

uniform seeds

by Alex Jordan -
Number of replies: 1
Is there a way to set all seeds to be the same for a set, or a course? One instructor would like to have student-led problem solving in class while still using WeBWorK, and that leads to a need for everyone's version to be the same.

I put
$envir{problemSeed}=1;

in course.conf, but this didn't help. The seeds from the database must be loaded after course.conf.
In reply to Alex Jordan

Re: uniform seeds

by Paul Pearson -
Hi Alex,

Here's an example of how to get two different PG files to use the same seed for randomization.  Put the following line in both PG files after loadMacros() but before any random() calls:

SRAND($psvn); # $psvn = problem set version number

and then make sure the PG files are in the same homework set.

Example in the OPL:

Library/Michigan/Chap7Sec4/Q01.pg
Library/Michigan/Chap7Sec4/Q08.pg

If you want to do this course wide, perhaps make sure that all of the webwork problems you're using have

loadMacros(...,"PGcourse.pl"); # load PGcourse.pl last

and then put

SRAND(100); # for the same seed always (100 is an arbitrary choice)

into the PGcourse.pl file.  I think (but don't know for sure) that the random seed may need to be set after macros such as PGstandard.pl are loaded but before any calls to random() are made, which is probably why your attempt setting $envir{problemSeed}=1; in course.conf failed to work.

Best regards,

Paul Pearson