/*
import java.util.Random;
public class random_1{
public static void main(String[] args) {
Random r=new Random();
int a=r.nextInt();
System.out.print("随机数为:"+a);
}
}
*/
//以下程序与上程序效果一样
public class random_1{
public static void main(String[] args) {
int r=(int)(Math.random()*10);
System.out.print(r);
}
}
时间: 2024-11-03 23:25:49