Collections (1) 썸네일형 리스트형 Java - 11 [Random , Collections] Random class - 여러형태의 난수를 생성할 때 필요하다. public class RandomExample { public static void main(String[] args) { System.out.println("0.0 ~ 1.0 사이의 난수 1개 발생 : " + Math.random()); System.out.println("0 ~ 10 사이의 난수 1개 발생 : " + (int)((Math.random()*10000)%10)); System.out.println("0 ~ 100 사이의 난수 1개 발생 : " + (int)(Math.random()*100)); } } 위 코드를 보면 기본적으로 Math.random() 함수는 0.0에서 1.0사이의 난수를 발생 시킨다. setSeed(lo.. 이전 1 다음