In Java, I need to randomly generate a number between 0
and 0.06
.
I saw on another question on here that the following code would do the trick:
Random generator = new Random();
double number = generator.nextDouble() * .06;
However, doing that gives me really long numbers like 0.007044013589130205
and 0.03656588431980957
, which I don't think is what my instructor is looking for.
Is there anyway to generate random numbers between 0 and 0.06 that only have two or three decimal places?