1 건의
트리셋 검색결과

 

TreeSet<Integer> lotto = new TreeSet<Integer>();        

Random random = new Random();
int sum = 0;

while (true) {

  while (lotto.size() != 6) {

    int randomNumber = random.nextInt(45) + 1;
    lotto.add(randomNumber);
    sum += randomNumber;

  }//InnerWhile

  if(100 < sum && sum < 170){
  	break;
  }else {
  	sum = 0;
  	lotto.clear();
  }    

}//OuterWhile