자바 기초 공부 일지 33. 난수(Random)


자바 기초 공부 일지 33. 난수(Random)

난수란 정의된 범위 내에서 무작위로 추출된 수입니다. 다음에 무슨 수가 나올지 알 수 없는 수, 즉 랜덤Random 수를 난수라고 합니다. 난수를 생성하는 구문은 다음과 같습니다. Random rand = new Random(); 각 랜덤 기능별 키워드는 다음과 같습니다. public boolean nextBoolean() boolean형 난수 반환 public int nextInt() int형 난수 반환 public long nextLong() long형 난수 반환 public int nextInt(int bound) 0 이상 bound 미만 범위의 int형 난수 반환 public float nextFloat() 0.0 이상 1.0 미만의 float형 난수 반환 public double nextDoub..


원문링크 : 자바 기초 공부 일지 33. 난수(Random)