WeBWorK Problems

Re: passing problem variables between sets

by Davide Cervone -
Number of replies: 0
One way to do this would be to force both problems to use the same random number seed, but have that seed be dependent on the student it is assigned to.

Here's a way to do that. Use the following line somewhere before you create any random numbers:

    $seed = 0; map {$seed += ord($_)} split(//,$studentID); SRAND(\$seed);

This reseeds the problem using a number that is created from the students ID (it turns each letter in the name into its ASCII value and then adds them up). This means each student (probably) has a different seed value, but any problems that start this way will have the SAME seed for each student.

If you use this at the top of both problems, and create the random variables in the same order in each problem, then each student should have the same random numbers in both problems.

Hope that does it for you.

Davide