Friday, December 21, 2018

Generate Random number using java

package programs;

import java.util.Random;

public class GenerateRandomNumber {

public void generateRandomNumber(){
Random ran =  new Random();

for(int i=0; i<5;i++){
int number = ran.nextInt(200);
System.out.println(number);
}
}

public static void main(String[] args) {
GenerateRandomNumber obj = new GenerateRandomNumber();
obj.generateRandomNumber();
}

}

No comments:

Post a Comment

TestNG - Can i use the 2 different data providers to same @test methods in TestNG?

public Object [][] dp1 () { return new Object [][] { new Object [] { "a" , "b" }, new Obje...