🍺JAVA

[JAVA]로또만들기 lotto

김말자 2022. 12. 30. 10:07
728x90
728x90
BIG
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		int[] lotto =new int[6];
		Random rm = new Random();
		rm.setSeed(System.currentTimeMillis());
		for(int i=0; i <lotto.length; i++) {
			int num = (int)(Math.random()*45)+1;
			lotto[i] = num;
			for(int j = 0; j < i ; j++) {
				if(lotto[i] == lotto[j]) {
					i--;
					break;
				}
			}
			System.out.print(lotto[i]+" ");
		}

728x90
반응형
BIG