//This program prints 1 random numbers into file "Random_Integers" import java.io.*; import java.util.Random; class random_example_file { public static void main(String args[]) throws IOException, FileNotFoundException { FileWriter myWriter = new FileWriter("Random_integers"); PrintWriter out = new PrintWriter(myWriter); Random rand = new Random(); //rand is now an object of class Random int value; for(int i = 0; i<15;i=i+1) { value = rand.nextInt(); //rand.nextInt returns the next random number value = Math.abs(value); value = value%1000; out.println(value); } myWriter.close(); } }