Math.random()取值范围[0.000000-0.999999]
Math.random()*100范围[0.0000-99.9999]
(int)(Math.random()*100)范围[0-99]
(int)(Math.random()*100+1)范围[1-100]
class Shu{
public static void main(String[] args){
for(int i =1;i<=100;i++){
Systme.out.println((int)(Math.random*100()+1));
}
}
}
|
|