How to generate random number in java

Here we learn how to generate random number in java
 
 
 
public class RandomNumber {
public static void main(String[] args) {
    
     int c;
    Random t = new Random();
    // random integers in [0, 100]
    for (c = 1; c <= 10; c++) {
      System.out.println(t.nextInt(100));
    }
}

 

Leave a Reply

Your email address will not be published. Required fields are marked *

80 − = 76