diff options
author | Martin Robertz <dream-master@gmx.net> | 2021-05-24 16:45:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-24 16:45:15 +0200 |
commit | 12582fb1cec74a5d05a1adfedc1eb04e4f7409c1 (patch) | |
tree | 18ebd936b02506772cd2004d0c893d8dcecb1cad /src/main/java/gregtech/api/objects/XSTR.java | |
parent | c39086946112174b81612e7fd96a2ce0ad056620 (diff) | |
parent | a4e104881944bbc03eddeacb24a6b7bd94cc53ce (diff) | |
download | GT5-Unofficial-12582fb1cec74a5d05a1adfedc1eb04e4f7409c1.tar.gz GT5-Unofficial-12582fb1cec74a5d05a1adfedc1eb04e4f7409c1.tar.bz2 GT5-Unofficial-12582fb1cec74a5d05a1adfedc1eb04e4f7409c1.zip |
Merge pull request #546 from GTNewHorizons/glow-texture
fix(render): grass block top grey in inventory
Diffstat (limited to 'src/main/java/gregtech/api/objects/XSTR.java')
-rw-r--r-- | src/main/java/gregtech/api/objects/XSTR.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/main/java/gregtech/api/objects/XSTR.java b/src/main/java/gregtech/api/objects/XSTR.java index a92c6bcff2..a2c4906345 100644 --- a/src/main/java/gregtech/api/objects/XSTR.java +++ b/src/main/java/gregtech/api/objects/XSTR.java @@ -44,7 +44,7 @@ public class XSTR extends Random { private static final double DOUBLE_UNIT = 0x1.0p-53; // 1.0 / (1L << 53) private static final float FLOAT_UNIT = 0x1.0p-24f; // 1.0f / (1 << 24) private static final AtomicLong seedUniquifier = new AtomicLong(8682522807148012L); - public final static XSTR XSTR_INSTANCE=new XSTR(){ + public static final XSTR XSTR_INSTANCE=new XSTR(){ @Override public synchronized void setSeed(long seed) { if(!Thread.currentThread().getStackTrace()[2].getClassName().equals(Random.class.getName())) @@ -86,10 +86,12 @@ public class XSTR extends Random { public XSTR(long seed) { this.seed = seed; } + @Override public boolean nextBoolean() { return next(1) != 0; } + @Override public double nextDouble() { return (((long)(next(26)) << 27) + next(27)) * DOUBLE_UNIT; } @@ -109,6 +111,7 @@ public class XSTR extends Random { * * @param seed the new seed */ + @Override public synchronized void setSeed(long seed) { this.seed = seed; } @@ -129,6 +132,7 @@ public class XSTR extends Random { * @param nbits * @return */ + @Override public int next(int nbits) { long x = seed; x ^= (x << 21); @@ -140,7 +144,8 @@ public class XSTR extends Random { } boolean haveNextNextGaussian = false; double nextNextGaussian = 0; - synchronized public double nextGaussian() { + @Override + public synchronized double nextGaussian() { // See Knuth, ACP, Section 3.4.1 Algorithm C. if (haveNextNextGaussian) { haveNextNextGaussian = false; @@ -213,6 +218,7 @@ public class XSTR extends Random { * @throws IllegalArgumentException if bound is not positive * @since 1.2 */ + @Override public int nextInt(int bound) { //if (bound <= 0) { //throw new RuntimeException("BadBound"); @@ -238,19 +244,23 @@ public class XSTR extends Random { int out = (int) last % bound; return (out < 0) ? -out : out; } + @Override public int nextInt() { return next(32); } + @Override public float nextFloat() { return next(24) * FLOAT_UNIT; } + @Override public long nextLong() { // it's okay that the bottom word remains signed. return ((long)(next(32)) << 32) + next(32); } + @Override public void nextBytes(byte[] bytes_arr) { for (int iba = 0, lenba = bytes_arr.length; iba < lenba; ) for (int rndba = nextInt(), |