日期:2014-05-20 浏览次数:20877 次
public class MathRandom{
public static int GetEvenNum(double a,double b){
int s = (int)a +(int)(Math.random()*(b-a));
if(s%2==0){
return s;
}else
return s+1;
}
public static void For(double a,double b){
for(int i=1;i<=6;i++){
System.out.println("s" + i + "=" + GetEvenNum(a,b));
}
System.out.println();
}
public static void main(String args[]){
For(1,1000);
}
}