I am trying to generate an array with N integer values between 0 and 100000.
Here is the code:
import java.util.*;
public class Main
{
public static Scanner input = new Scanner(System.in);
public static void main(String[] args)
{
int N;
System.out.println();
System.out.print("Enter an integer number: ");
N = input.nextInt();
int[] a = new int[N];
Random generator = new Random();
for(int i = 0; i < a.length; i++)
{
a[i] = generator.nextInt(100001);
}
}
}
What I notice that, at every time I generate new array, most of the integer numbers in the array is 5-digit numbers, sometimes there are 4-digit numbers, and rarely there are 3-digit numbers, but never happened that I found 2-digit or fewer numbers.
is my implementation wrong?