public class MyRandom extends Random {
private int a;
private int b;
protected int m;
public int getM() {
return m;
}
protected void setM(int m) { this.m = m;}public MyRandom() { // TODO Auto-generated constructor stub this(0,10); //!}public MyRandom(int a ) { this(0,a);}public MyRandom(int a,int d) { a=a; //注意这里面同名的问题。 如果这样写,就错了,系统分辨不出来。*****要改成this.a=a;this.b=b或者将形参换名字。***** d=d;}public int nextInt() {
// return Math.abs(super.nextInt()%b+a);
return super.nextInt(b-a+1)+a;
}