33 lines
679 B
Java
33 lines
679 B
Java
package openonyx.history;
|
|
|
|
import openonyx.history.internal.RangeSetting;
|
|
|
|
public class RangeRoll {
|
|
private double f;
|
|
private final boolean H;
|
|
private final RangeSetting rangeSetting;
|
|
|
|
public void L() {
|
|
this.f = this.H ? this.rangeSetting.randomInt() : this.rangeSetting.random();
|
|
}
|
|
|
|
public RangeRoll(RangeSetting rangeSetting) {
|
|
this.rangeSetting = rangeSettingx;
|
|
this.H = rangeSettingx.isInteger();
|
|
rangeSettingx.onChange(range -> this.L());
|
|
this.L();
|
|
}
|
|
|
|
public int L() {
|
|
return (int)Math.round(this.f);
|
|
}
|
|
|
|
public float L() {
|
|
return (float)this.f;
|
|
}
|
|
|
|
public double L() {
|
|
return this.f;
|
|
}
|
|
}
|