07-15-2014, 12:22 AM
What is the expected behavior of RANDINT? According to Help, RANDINT(r,a,b) returns a list of size r which each element being a random integer from a to b.
However, the returned list may include a if a is greater than or equal to 0, but it will not include a if a is less than 0.
For example:
RANDINT(5,-1,1) returns {0,1,0,1,1} (but never a -1 in that list)
RANDINT(5,-2,1) returns {-1,-1,1,1,-1}
RANDINT(5,0,1} returns {1,0,1,1,1}
Furthermore, while Help on RANDINT(r,a,b) seems to imply that a is less than b,
the prime accepts inputs like RANDINT(r,5,-5). I am not sure how to interpret the output.
Any help? Thank you.
However, the returned list may include a if a is greater than or equal to 0, but it will not include a if a is less than 0.
For example:
RANDINT(5,-1,1) returns {0,1,0,1,1} (but never a -1 in that list)
RANDINT(5,-2,1) returns {-1,-1,1,1,-1}
RANDINT(5,0,1} returns {1,0,1,1,1}
Furthermore, while Help on RANDINT(r,a,b) seems to imply that a is less than b,
the prime accepts inputs like RANDINT(r,5,-5). I am not sure how to interpret the output.
Any help? Thank you.