로또번호 뽑기
/*1~45사이에서 6개 뽑아서
숫자가 중복되서는 안됨 
로또번호 추첨하기

오늘의 추천 로또번호는 ~~~ 입니다.*/


public class Quiz_07 {
	public static void main(String[] args) {
		//numbers 배열참조변수 선언, 45개의 배열 생성
		int[] numbers= new int[45];
		
		//numbers 배열참조변수에  0~44 인덱스에 1~45(i+1)숫자 넣어주기
		for(int i=0;i<numbers.length;i++) {
			numbers[i]=i+1;
		}
		
		//카드섞기 기법
		for(int i=0;i<1000;i++) { //카드를 100번 섞는다는 느낌
			int x=(int)(Math.random()*(44-0+1)+0); // 인덱스x를 위한 난수 
			int y=(int)(Math.random()*(44-0+1)+0); // 인덱스y를 위한 난수
			int temp; //스왑기법을 위한 변수공간
			
			temp=numbers[x]; //temp에 numbers[x]에 있는 데이터가 들어가고
			numbers[x]=numbers[y]; //numbers[x]에 numbers[y]에 있는 데이터가 들어가고
			numbers[y]=temp;//numbers[y]에 temp에 저장해놨던 본래의 numbers[x]의 데이터가 들어감
			//numbers[x]와 numbers[y]의 데이터가 서로 위치를 스왑하게 됨
		}
		
		//출력하기
		System.out.print("오늘의 추천 로또 번호는 ");
		for(int i=0;i<6;i++) {
			//카드섞기 기법으로 배열의 값들이 모두 섞었기 때문에
			//인덱스 0~6부터 출력해도 이미 뒤죽박죽 섞인 숫자들이 나옴
			System.out.print(numbers[i] + " ");
		}
		System.out.print(" 입니다.");
		
	}
}