Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

Im building a random number generator and I keep getting an error

Im building a random number generator and I keep getting an error

and I’m not sure why. can anyone explain what is wrong with my code and why? error received is ” exception in thread “main” java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0″
codes is as follows:
import java.util.Random;

public class RandomGenerator {

public static void main(String[] args) {
// variable definition
int x;
int y;
int newrandom;

//random number generator
Random ranum = new Random();

x = Integer.parseInt(args[0]);
y = Integer.parseInt(args[1]);

//create loop
for(int z = 0; z < x; z++){
newrandom = ranum.nextInt(y);
System.out.println(newrandom);
}
}

 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"