一个random的问题
public class Sanch {
public static void main(String args[]){
System.out.println((int)Math.random()*100+1);
}
}
为什么加上(int)之后输出的值一直为1呢,不加(int)输出的之随机。为什啊,求各位帮忙解答,谢谢。
2017-04-10 19:08
2017-04-10 19:55
2017-04-10 22:21