hello there, I have a bit of trouble figuring out how to finish a code for an assignment. I'm supposed to write a class that can generate a sequence of psudorandom integers using the linear congruence method. The trick of it is that the number generated will become the new seed and that's what I'm having trouble figuring out.
Here's my code.
public class pseudorandom {
private int multi;
private int seed;
private int incr;
private int modu;
public pseudorandom (int m, int s, int i, int mod){
multi = m;
seed = s;
incr = i;
modu = mod;
}
public void setMulti(int multi) {
this.multi = multi;
}
public int getMulti() {
return multi;
}
public void setSeed(int seed) {
this.seed = seed;
}
public int getSeed() {
return seed;
}
public void setIncr(int incr) {
this.incr = incr;
}
public int getIncr() {
return incr;
}
public void setModu(int modu) {
this.modu = modu;
}
public int getModu() {
return modu;
}
public int print(){
return (((multi * seed) + incr) % modu);
}
public static void main(String[] args) {
pseudorandom x = new pseudorandom (3, 134, 23, 90);
System.out.println(x.print());
}
}