暑假周记(7.23)
round 四舍五入 Math.floor(该参数+0.5)
long round = Math.round(5.51);
System.out.println(round);//6
sqrt 求开方
double sqrt = Math.sqrt(9.0);
System.out.println(sqrt);//3.0
random 求随机数
random 返回的是 0 <= x < 1 之间的一个随机小数
System.out.println(Math.random())//输出0~1之间的一个随机小数

浙公网安备 33010602011771号