## WeBWorK Problems

### random(1,1,1) causing a hangup

by Alex Jordan -
Number of replies: 1

On a 2.16 server, with seed 3163, I am experiencing an issue. I vaguely recall maybe some changes were made to random(), and maybe that is part of my issue.

I tried to minimize the code below to demonstrate the issue, but I can't seem to minimize it more than this. As it is, with seed 3163, the problem takes a long time to load and then reports an error. One way to clear it up is if I replace the "random(1,1,1)" with just "1".

The error message:

The somewhat minimized problem code:
DOCUMENT();

"PGstandard.pl",
);

##############################################

$a11 = random(1,1,1);$a21 = random(0,0,1);
$a31 = random(0,0,1);$a41 = random(1,9,1);

$a12 = random(1,5,1);$a22 = random(-3,3,1);
$a32 = random(-5,2,1);$a42 = random(-4,-2,1);

$a13 =$a21*$a32-$a31*$a22;$a23 = $a31*$a12-$a11*$a32;
$a33 =$a11*$a22-$a21*$a12;$a43 = random(-3,3,1);

$a14 = random(1,5,1);$a24 = random(-3,3,1);
$a34 = random(-5,2,1);$a44 = random(-4,-2,1);

while ($a11*($a22*$a33*$a44 + $a23*$a34*$a42 +$a24*$a32*$a43 - $a22*$a34*$a43 -$a23*$a32*$a44 - $a24*$a33*$a42) -$a41*($a12*$a23*$a34 +$a13*$a24*$a32 + $a14*$a22*$a33 -$a12*$a24*$a33 - $a13*$a22*$a34 -$a14*$a23*$a32) == 0)
{$a14 = random(1,5,1);$a24 = random(-3,3,1);
$a34 = random(-5,2,1);$a44 = random(-4,-2,1);}

ENDDOCUMENT();

### Re: random(1,1,1) causing a hangup

by Danny Glin -

I don't think that random is the problem here.  When I create a problem with an infinite loop I get the same error message that you posted.  One tipoff is that the stack trace contains WeBWorK::PG::Local::alarm_handler, which is only invoked if processing a problem times out.

In previous versions of WeBWorK you would get a warning at the bottom of the page that suggested that there may be an infinite loop.  It looks like that warning isn't making it as far as the webpage anymore.

In fact, if you comment out the while loop, and display the values for all of the variables for that seed (3163), the matrix generated is

1     4     0     1

0     0     0     1

0     0     0    -5

7    -3    -3    -2

The first three columns of this matrix are linearly dependent, so rerandomizing the fourth column will never lead to a nonzero determinant.