프로그래밍/ㆍC/C++/Java
[Java] LottoNumber - 랜덤함수, HashSet으로 로또 번호 추출하기 예제
쪼재
2012. 2. 12. 13:47
// LottoNumber.class public class LottoNumber { public static void main(String[] args) { HashSetset = new HashSet (); while(set.size()<=6) { set.add((int)(Math.random() * 44) + 1); } for(int a : set) { System.out.println(a); } } }