I'm trying to write a program that takes an array of 200 numbers (1-200), randomizes them, and then outputs those numbers to a text file.
I've been struggling for the whole day and I can't figure out why nothing is working.
Main method:
public static void main (String[] args)
{
int[] numbers= new int [201];
for (int i=0; i < numbers.length; i++)
{
numbers[i]=i;
}
}//end main method
Randomize method:
public static int[] randomizeArray(int[] numbers)
{
Random gen= new Random(10);
for (int i=0; i < numbers.length; i++)
{
int n= gen.nextInt(200);
numbers[i]=n;
}
return numbers;
}//end randomizeArray method
And the print method:
public static int[] outputArray(int[] numbers) throws IOException
{
FileOutputStream output;
output= new FileOutputStream("RandomOut.txt");
new PrintStream(output).println(randomizeArray(numbers));
output.close();
return numbers;
}//end method outputArray
Any help would be great, I know I'm overlooking something or doing something incorrectly.