In Java, I am trying to populate an array with random numbers. The array has to be the size that the user inputs. For example, if the user enters 6, then the array must have 6 numbers in it. This is what I have for this program so far. It compiles and runs, but prints out only 0's. I am a little new to Java.
{
System.out.println("Enter a number: " );
int number = scan.nextInt();
int [] integerArray = new int[number];
for (int i=0; i < number; i++)
{
integerArray[i] = (int)(Math.random());
}
System.out.println(Arrays.toString(integerArray));
}