java生成随机数

 1 public class text1 {
 2     // TODO Auto-generated method stub
 3     
 4     public static int Random(int number1,int number2){
 5         return (int) (number1+ Math.random()*(number2-number1));
 6         
 7     }
 8     public static void main(String[] args) {
 9         System.out.println(Random(1,10));
10     }
11 }
View Code

 

posted @ 2019-03-19 12:15  小小超plus  阅读(249)  评论(0编辑  收藏  举报