public class GenTicket {
/**
*
* 双色球算号器
*/
public static void main(String[] args) throws IOException {
System.out.print("Input your lucky number: ");
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int i = Integer.parseInt(in.readLine());
Random random = new Random(i);
Set set = new HashSet();
while(set.size() < 6) {
int num = Math.abs(random.nextInt() % 33) + 1;
set.add(new Integer(num));
}
int blue = Math.abs(random.nextInt() % 16) + 1;
System.out.print("red: ");
Iterator red = set.iterator();
while(red.hasNext())
System.out.print(red.next() + " ");
System.out.println('\n' + "blue: " + blue);
}
}
|