Java数値Math.random
Math.round

Math.random数値

Math.log

0.0以上1.0未満のdouble値を返します。

문법

Math.random()

예제

아래 값을 입력하면 예제에 즉시 반영됩니다.

double
Math
dice
System
out
println
double rand = Math.random();           // 0.0 ~ 1.0 미만
int dice = (int)(Math.random() * 6) + 1; // 1~6
System.out.println(dice);