WeBWorK Main Forum

uniform seeds

Re: uniform seeds

by Paul Pearson -
Number of replies: 0
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:


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