Originally posted by Jeff Bosch:
int random = r.nextInt( 2 * number ) - number;
Keep in mind that Random.nextInt(number) returns a value in the range [0, number), meaning 0, 1 ... number - 1. It will
not return number itself. Thus the general solution should be changed to