WeBWorK Problems

Rounding in Random Numbers

Re: Rounding in Random Numbers

by Danny Glin -
Number of replies: 0
This is one of the dangers of floating point operations.  Any time you are doing arithmetic with decimal numbers, you risk these errors.

In my experience, the following code hasn't caused any of these issues:
$a = random(-100,100) / 10;

Danny