首页 > 技术文章 > 随机数

Yxxxxx 2017-05-31 18:07 原文

public class Test4 {

public static void main(String[] args) {
int x=(int) (Math.random()*100);//100以内的随机数
int y=(int) Math.random();//0或者1

System.out.println(x);
System.out.println(y);
}
}

 

推荐阅读