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