Closed dmalec closed 1 year ago
@dmalec Would you like this merged, or did you want to work on it more to fix the negative numbers problem as well?
@dmalec Would you like this merged, or did you want to work on it more to fix the negative numbers problem as well?
@jrincayc - I'd like to work on it a bit more to fix the negative number problem; I'll mark it as in progress.
@jrincayc - this PR now contains a proposed change for allowing negative numbers in ranges and is ready for re-review.
Resolves #150
Summary
The
RANDOM
procedure does not check if the first parameter is less than the second parameter on the two input form. This change adds an explicit check and errors if the range is out of order based on the description of the procedure in the manual. It also permitsRANDOM
to accept a range including negative numbers.Testing
Without this change, passing in a higher number first leads to unexpected results:
After making this change, passing in a higher number will produce an error:
Which is equivalent to passing a negative number to the single input form:
This change also allows negative numbers in the range:
While also enforcing the ordering constraint on the range even when negative:
Test Environments