See the lottery results. (Available at 5pm).
Due to the high demand for the AITI Java course, we will lottery 30 spots.
The selection program initializes a list of integers from 1 to n. Then, we use the Java's Collections.shuffle routine to randomize the order of the numbers in the list. The fairness of the algorithm relies on the randomness of Java's pseudorandom generator. We have used the long representation of the time 5:00 PM, July 19, 2004, as the random seed. You can check our results by running the code below:
import java.util.*;
public class Lottery {
public static void main( String[] args ) {
final int n = 93;
List students = new ArrayList(n);
//Initialize Array
for (int i = 0; i < n; i++ )
students.add(new Integer( i + 1 ));
//Random Seed
Calendar calendar = new GregorianCalendar(2004,
Calendar.JULY,
19, 17, 0, 0);
long randomSeed = calendar.getTimeInMillis();
//Randomize Array
Collections.shuffle(students, new Random(randomSeed));
//Print out top 30
for (int i = 0; i < 30; i++ )
System.out.println( students.get(i) );
}
}