This question was asked before Java 7 release but now, there is another possible way using Java 7 (and above) API:
double random = ThreadLocalRandom.current().nextDouble(min, max);
nextDouble
will return a pseudorandom double value between the minimum (inclusive) and the maximum (exclusive). The bounds are not necessarily int
, and can be double
.