import java.util.*; import java.util.Random.*; /** * author: John Sloan) * version: 01-11-2009 */ public class TestRandom { //instance class variable int [ ] a; //Constructor: Allows the size and range of the array to be determined by the //other classes or the user. //establishes a range of 0-max and deposits a random number //http://leepoint.net/notes-java/algorithms/random/random-api.html , //collection random class sample //code public TestRandom( int size, int max ) { Random random = new Random (); a = new int[size]; for(int i = 0; i < size; i++) { a[i] = random.nextInt(max); //see library } } int index=0; public void printArray () { for(int i=0; i0) { System.out.println("A[" + i + "] =" + a[i] + " ;"); } else { for(int b=0; b