⚡ Java.util.Random

sonjh919·2023년 10월 18일
0

Java API

목록 보기
13/16
post-thumbnail

🌈 java.util.Random

  • random.nextInt(구하려는 난수의 개수) + 구하려는 난수의 최소값
  • 0~파라미터 사이의 random한 정수 반환
// 1~10
int random1 = random.nextInt(10) + 1;

// 10 ~ 15
int random2 = random.nextInt(6) + 10;

0개의 댓글