random使用方法
使用说明:返回的是(0<=n<1)这个范围中的任意带正号的double值
代码实例
public class helloworld{
public static void main(String[] args){
System.out.println(Math.random());
}
}
生成0-100中的任意数代码示例
public class Main {
public static void main(String[] args) {
while(true) {
int a=(int)(Math.random()*100+1);
System.out.println(a);
if(a == 100){
break;
}
}
}
}
767

被折叠的 条评论
为什么被折叠?



