产生随机数
Math.random() 产生一个 [0.0, 1.0) 范围的double
public class test {
public static void main(String[] args) {
int number1 = (int) (Math.random() * 10);
double number2 = Math.random();
System.out.println(number1 + " | " + number2);
}
}
产生随机数
Math.random() 产生一个 [0.0, 1.0) 范围的double
public class test {
public static void main(String[] args) {
int number1 = (int) (Math.random() * 10);
double number2 = Math.random();
System.out.println(number1 + " | " + number2);
}
}