I'm a Java noob trying to generate a random double between -10 and 10 inclusive. I know with ints I would do the following:
Random r = new Random();
int i = -10 + r.nextInt(21);
However, with doubles, this doesn't work:
Random r = new Random();
double i = -10 + r.nextDouble(21);
Can someone please explain what to do in the case of doubles?