abs 绝对值pow 求幂ceil 向上取整floor 向下取整round 四舍五入sqrt 开平方random 求随机数,返回[0-1)之间的随机数max 求两个数的最大值min 求两个数的最小值 练习 public static void main(String[] args) { // 求2到9之间的随机数 for (int i = 0; i < 100; i++) { System.out.println((int) (Math.random() * (9 - 2 + 1) + 2)); } }