Possible Duplicate:
Generating random number in a range with Java
double x = //Random number between -0.5 and 0.5
Possible Outputs:
-0.23
0.01
0.26
-0.4
How do I generate a double between the range of (example) -0.5 and 0.5?
return min + Math.random() * (max - min);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With