diff options
Diffstat (limited to 'src/Java/gtPlusPlus/api/objects/random/XSTR.java')
-rw-r--r-- | src/Java/gtPlusPlus/api/objects/random/XSTR.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/Java/gtPlusPlus/api/objects/random/XSTR.java b/src/Java/gtPlusPlus/api/objects/random/XSTR.java index 7f83df52c4..4b5b1298b6 100644 --- a/src/Java/gtPlusPlus/api/objects/random/XSTR.java +++ b/src/Java/gtPlusPlus/api/objects/random/XSTR.java @@ -213,9 +213,14 @@ public class XSTR extends Random { */ @Override public int nextInt(final int bound) { - //if (bound <= 0) { + final int newBound; + if (bound <= 0) { + newBound = 1; //throw new RuntimeException("BadBound"); - //} + } + else { + newBound = bound; + } /*int r = next(31); int m = bound - 1; @@ -234,7 +239,7 @@ public class XSTR extends Random { this.last ^= (this.last >>> 35); this.last ^= (this.last << 4); this.seed = this.last; - final int out = (int) this.last % bound; + final int out = (int) this.last % newBound; return (out < 0) ? -out : out; } @Override |