I'm trying to get a random number to be generated between -.5 and .5, but I'm running into some errors
Rng.java:11: error: ';' expected
double randomWithRange(double min, double max)
^
Rng.java:11: error: <identifier> expected
double randomWithRange(double min, double max)
^
Rng.java:11: error: not a statement
double randomWithRange(double min, double max)
^
Rng.java:11: error: ';' expected
double randomWithRange(double min, double max)
and here's the code
class Rng
{
double min = -0.5;
double max = 0.5;
public static void main(String[] args)
{
double randomWithRange(double min, double max)
{
double range = (max - min);
return (Math.random() * range) + min;
}
}
}
Can anyone help me out?