wwwzjcom
发贴: 3
积分: 0
|
于 2006-06-23 21:32
public class RandomTest { private static final int SET_SIZE = 6; public static final int RANDOM_MAX_VALUE = 33; private static Random random = new Random(); public static void main(String[] args) { Set set = new HashSet(); while (set.size() < SET_SIZE ) { Integer integer =new Integer(random.nextInt(RANDOM_MAX_VALUE) ); set.add(integer); } Iterator it = set.iterator(); while(it.hasNext()) { System.out.println("Output A ball:"+it.next()); } int i; i=random.nextInt(16)+1; System.out.print("Output B ball:"+i); } } 如何屏蔽在A球输出中输出0?
|