Random random = new Random(); double num = random.nextDouble(); System.out.println(num);
Random random = new Random(); double[] nums = new double[5]; for(int i=0; iOutput: 0.7189658022662046 0.1811095292039645 0.6939896802777863 0.3371495417259911 0.7767245967358654 This example generates an array of 5 random double values and prints them to the console. The java.util.Random class is part of the Java Standard Library.