You can declare a start
and end
variables (int
or double
), and use nextDouble()
like:
value = rnd.nextDouble() * (end - start) + start;
Remember that:
public double nextDouble() Returns the next pseudorandom, uniformly distributed double value between 0.0 and 1.0 from this random number generator's sequence.