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.