[자바] 랜덤숫자 메소드

BEHE_LIT·2020년 2월 11일
0

삽질 스토리

목록 보기
16/19
static void method(int a) {
       int[] array = new int[a];
        for (int i=0; i<a; i++) {
            array[i] = (int)(Math.random()*a+1);
            System.out.print(array[i]+" ");
        }
    }

    public static void main(String[] args) {
        method(a); //인자값 입력
    }

요렇게 함수놀이를 생활화해볼까 한다. 뭔가 정리가 되는 느낌이다b

profile
방랑자의 현장에 오신걸 환영합니다.

0개의 댓글