Online Java Compiler By
JavaTpoint.com
public class RandomExample3 { public static void main(String[] args) { // Generate random number between 5 to 30 double a = 5 + (Math.random() * 30); double b = 5 + (Math.random() * 30); // Output is different every time this code is executed System.out.println(a); System.out.println(b); } }
Output