企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持知识库和私有化部署方案 广告
~~~ import java.util.*; public class Test{ public static void main(String[] args){ Random xx =new Random(); int number=xx.nextInt(10);//0-9 System.out.println("随机数为"+number); } } ~~~ 或者,下面的方法支持多线程 ~~~ public class Test{ public static void main(String[] args){ System.out.println((int)(Math.random()*10)); } } ~~~