方法①Random random = new Random(); int a=random.nextInt(10); System.out.println(a);方法②int random=(int)(Math.random()*10);