Hi Zig and Mike,
Zig, I think you are correct. Mike did change the code from using
rand(1) to using essentially random(0,1,.01) (with random being
WeBWorK's random, not Perl's rand) and this gives a random number from
the list 0, .01, ..., .99, 1 rather than a random floating point number
in the range [0,1). So now there is a closed interval and a rather high
probability of hiting an endpoint.
Here's the code:
my $random_for_answers = new PGrandom $main::PG_original_problemSeed);
...
$vars[$i] = $random_for_answers->random($limits[$i][0], $limits[$i][1], abs($limits[$i][1] - $limits[$i][0])/100 );
assuming I'm looking at the correct piece of the code.
I'm not certain at this point how best to fix it so people do not have
the bugs you have encountered. I'll let Mike think about this. Some
possibilities are changing the code in PGanswermacros.pl so that it
behaves like the original and changing the default in Global.pm from
$functULimitDefault = 1; to $functULimitDefault = .9999999; (but this
wouldn't fix your bug). Whatever we do the documentation needs to
reflect this. As you mention, if we keep things as they are, this will
cause bugs in the distributed problems. Changing $functULimitDefault =
.9999999; will fix all the bugs except where people define their own
limits.
As at temporary fix I have reset $functULimitDefault = .9999999; in Global.pm at Rochester
Arnie
<| Post or View Comments |>
|