Question:
create a Random number generator without using the java in build Random class?
Solution:
public class Random {
protected static long limit = 65536;
protected static long unit = 2053;
protected static long offset = 13849;
private long seed;
public Random() {
this(10);
}
public Random(long seed) {
this.seed = seed % limit;
}
public Long next() {
return seed = (seed * unit + offset) % limit;
}<span style="font-family: sans-serif;">}</span>