반응형
math
-
[JAVA 37] 자바 랜덤 / 무작위 ( Random )Language/Java 2018. 2. 26. 15:45
■ Random ( 랜덤 ) 1. With Random12345678910111213141516171819import java.util.*; class RandomS2{ Random random = new Random(); void m1(){ // 방법 1. With Random int a = 3; int b = random.nextInt(a); // 0 , 1 , 2 >> 0 ~ ( n-1 ) System.out.println("b : " + b); boolean c = random.nextBoolean(); System.out.println("c : " + c); } public static void main(String[] args){ RandomS2 rs2 = new RandomS2(); rs2...