If you want to get a random value for a range of decimal point numbers , it's done this way:
Random r = new Random();
resultado = r.nextFloat() * (maximo - minimo) + minimo;
This is an example:
float maximo = 2.0f;
float minimo = 0.1f;
float resultado;
for (int i=0; i<100; i++){
Random r = new Random();
resultado = r.nextFloat() * (maximo - minimo) + minimo;
System.out.println("Numero:" +resultado);
}
Online example
You can get a random value from a range of integer values like this:
Random r = new Random();
resultado = r.nextInt((maximo - minimo) + 1) + minimo;
This is an example:
int maximo = 10;
int minimo = 3;
int resultado;
for (int i=0; i<100; i++){
Random r = new Random();
resultado = r.nextInt((maximo - minimo) + 1) + minimo;
System.out.println("Numero:" +resultado);
}
Online example.