Changing random output to be in [lower, upper)
This avoids doing upper - lower + 1 I used earlier which overflowed in common case of calling random with default lower and upper bound