You asked me to show you:
public class FixRandom {
// Holds the fixed random value.
private final int fixedValue;
// Upper bound for the RNG.
private static final int BOUND = 10;
// Constructor.
public FixRandom() {
// Set the fixed random value.
Random rand = new Random();
fixedValue = rand.nextInt(BOUND);
}
// Method to access the fixed random value.
public int getFixRandom() {
return fixedValue;
}
}
When you need to retrieve the number, use the getFixRandom()
method.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…