Skip to main content

[Java] 로또번호생성기

import java.util.*; // Random 클래스를 사용하기 위해.. class ExRandom2 { public static void main(String[] args) { int[] lotto = new int[] {0, 0, 0, 0, 0}; // 로또번호 저장할 배열 int temp, i, j, index=0; // 로또번호정렬, 인덱스에 쓰일 변수 Random rand = new Random(); // 난수생성을 위해 Random클래스 객체생성 while(index<5) { lotto[index++] = rand.nextInt(45)+1; […]

Read More