Generate Random Numbers Program In Java


package com.java2study;

import java.util.Random;

public class RandomGeneratorDemo {


public static void main(String[] args) {
Random r = new Random();
for(int i = 1;i<=7;i++){
int randomNumber = r.nextInt(175);
System.out.println("The Random Numer is :"+randomNumber);
}

}

}

output


The Random Numer is :3
The Random Numer is :32
The Random Numer is :91
The Random Numer is :34
The Random Numer is :135
The Random Numer is :110
The Random Numer is :133

No comments:

Post a Comment