+ 1
You may use random() function of the Math class
Syntax = Math.random();
Eg.
import java.util.LinkedList;
public class random{
public void randomnumber{
double a = Math,random();
double b = Math,random();
double c = Math,random();
double d = Math,random();
double e = Math,random();
LinkedList<Double> list = new LinkedList<Double>;
list.getItems().addAll(a,b,c,d,e);
list.sort();
for(int f : list)
{
System.out.println(list.get(f));
}
double avg = (a+b+c+d+e)/5;
System.out.println(avg);
}
}