暑假周记(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之间的一个随机小数
 

posted @ 2023-07-23 19:29  夏季彼岸德  阅读(12)  评论(0)    收藏  举报