import java.util.Random; /** * An example program that generate 10 random numbers between 0 and 100. */ public class ExampleProgram { public static void main(String[] args) { Random rnd = new Random(); int i = 0; while (i<10) { System.out.println(rnd.nextInt(100)); i++; } } }
And we get below output when we run this code:
31 60 20 67 77 77 81 17 55 21