随机数的两种用法 方法一:Random rand=new Random(); int num=rand.next(3)+1; 方法二: int num2=Math.random(3)+1; 运行的结果范围都在1~3之内