/* Math.random 메소드를 활용한 로또번호 발생기(중복제외) */
public class MathRandomTest {
public static void main(String args[])
{
int lotto[] = new int[6];
int random;
boolean check = true;
for(int i=0; i<lotto.length; i++)
{
random = (int)(Math.random()*45+1);
for(int j=0; j<lotto.length; j++)
if(lotto[j] == random)
check = false;
if(check)
{
lotto[i] = random;
System.out.print(lotto[i]+" ");
}
else
i--;
}
}
}