random number generator for the new powerball
DESCRIPTION
Beginning on January 2009, the new PowerBall will have 59 whiteballs and 39 powerballs to choose from.This simple java program will generate 5 random numbers from 1-59 and 1 number from 1-39.GOOD LUCK!TRANSCRIPT
PowerBallimport java.util.*;
class PowerBall {public static void main(String[] args) {System.out.println();for(int i=0; i< 30; i++) {boolean[] taken = new boolean[60];int count = 0;Random r = new Random();int[] uniqueRNums = new int[5];
while(count < 5){ int rNum = (r.nextInt(59) + 1);if(!taken[rNum]){taken[rNum] = true;uniqueRNums[count] = rNum;count++;System.out.print(rNum + " ");}}
System.out.println(" " + (r.nextInt(39) + 1) + "\n");
}}}
Page 1