001package squidpony.squidmath; 002 003/** 004 * A low-quality continuous noise generator with strong grid artifacts, this is nonetheless useful as a building block. 005 * This implements Noise2D, Noise3D, and Noise4D, and could have more dimensionality support added later. It has much 006 * lower quality than {@link ClassicNoise}, but is structured similarly in many ways, and should be a little faster. 007 * <br> 008 * Note: the {@link #valueNoise(int, double, double)} methods in this class return results in the range of 0.0 to 1.0, 009 * while the {@link #getNoise(double, double)} and {@link #getNoiseWithSeed(double, double, long)} methods use the Noise 010 * class default range of -1.0 to 1.0. 011 * @see FoamNoise FoamNoise produces high-quality noise by combining a few rotated results of ValueNoise with domain warping. 012 * @see PhantomNoise PhantomNoise doesn't use this class directly, but does have its own way of generating arbitrary-dimensional value noise. 013 */ 014public class ValueNoise implements Noise.Noise1D, Noise.Noise2D, Noise.Noise3D, Noise.Noise4D { 015 public static final ValueNoise instance = new ValueNoise(); 016 017 public int seed = 0xD1CEBEEF; 018 public ValueNoise() { 019 } 020 021 public ValueNoise(int seed) { 022 this.seed = seed; 023 } 024 025 public ValueNoise(long seed) { 026 this.seed = (int) (seed ^ seed >>> 32); 027 } 028 029 public static double valueNoise(int seed, double x) { 030 int xFloor = x >= 0 ? (int) x : (int) x - 1; 031 x -= xFloor; 032 x *= x * (3 - 2 * x); 033 xFloor *= 0x9E377; 034 seed ^= seed >>> 17; 035 return ((1 - x) * hashPart1024(xFloor, seed) + x * hashPart1024(xFloor + 0x9E377, seed)) 036 * (0x1.0040100401004p-10); 037 } 038 private static int hashPart1024(final int x, int s) { 039 s *= ((x ^ x >>> 12) | 1); 040 s = (s ^ s >>> 16) * 0xAC451; 041 return (s >>> 3 ^ s >>> 10) & 0x3FF; 042 } 043 044 public static double valueNoise(int seed, double x, double y) 045 { 046 int xFloor = x >= 0 ? (int) x : (int) x - 1; 047 x -= xFloor; 048 x *= x * (3 - 2 * x); 049 int yFloor = y >= 0 ? (int) y : (int) y - 1; 050 y -= yFloor; 051 y *= y * (3 - 2 * y); 052 xFloor *= 0xD1B55; 053 yFloor *= 0xABC99; 054 return ((1 - y) * ((1 - x) * hashPart1024(xFloor, yFloor, seed) + x * hashPart1024(xFloor + 0xD1B55, yFloor, seed)) 055 + y * ((1 - x) * hashPart1024(xFloor, yFloor + 0xABC99, seed) + x * hashPart1024(xFloor + 0xD1B55, yFloor + 0xABC99, seed))) 056 * (0x1.0040100401004p-10); 057 } 058 059 //// constants are the most significant 20 bits of constants from PhantomNoise, incremented if even 060 //// they should normally be used for the 3D version of R2, but we only use 2 of the 3 constants 061 //x should be premultiplied by 0xD1B55 062 //y should be premultiplied by 0xABC99 063 private static int hashPart1024(final int x, final int y, int s) { 064 s += x ^ y; 065 return (s ^ (s << 19 | s >>> 13) ^ (s << 5 | s >>> 27) ^ 0xD1B54A35) * 0x125493 >>> 22; 066 } 067 068 public static double valueNoise(int seed, double x, double y, double z) 069 { 070 int xFloor = x >= 0 ? (int) x : (int) x - 1; 071 x -= xFloor; 072 x *= x * (3 - 2 * x); 073 int yFloor = y >= 0 ? (int) y : (int) y - 1; 074 y -= yFloor; 075 y *= y * (3 - 2 * y); 076 int zFloor = z >= 0 ? (int) z : (int) z - 1; 077 z -= zFloor; 078 z *= z * (3 - 2 * z); 079 //0xDB4F1, 0xBBE05, 0xA0F2F 080 xFloor *= 0xDB4F1; 081 yFloor *= 0xBBE05; 082 zFloor *= 0xA0F2F; 083 return ((1 - z) * 084 ((1 - y) * ((1 - x) * hashPart1024(xFloor, yFloor, zFloor, seed) + x * hashPart1024(xFloor + 0xDB4F1, yFloor, zFloor, seed)) 085 + y * ((1 - x) * hashPart1024(xFloor, yFloor + 0xBBE05, zFloor, seed) + x * hashPart1024(xFloor + 0xDB4F1, yFloor + 0xBBE05, zFloor, seed))) 086 + z * 087 ((1 - y) * ((1 - x) * hashPart1024(xFloor, yFloor, zFloor + 0xA0F2F, seed) + x * hashPart1024(xFloor + 0xDB4F1, yFloor, zFloor + 0xA0F2F, seed)) 088 + y * ((1 - x) * hashPart1024(xFloor, yFloor + 0xBBE05, zFloor + 0xA0F2F, seed) + x * hashPart1024(xFloor + 0xDB4F1, yFloor + 0xBBE05, zFloor + 0xA0F2F, seed))) 089 ) * (0x1.0040100401004p-10); 090 } 091 092 //// constants are the most significant 20 bits of constants from PhantomNoise, incremented if even 093 //// they should normally be used for the 4D version of R2, but we only use 3 of the 4 constants 094 //x should be premultiplied by 0xDB4F1 095 //y should be premultiplied by 0xBBE05 096 //z should be premultiplied by 0xA0F2F 097 private static int hashPart1024(final int x, final int y, final int z, int s) { 098 s += x ^ y ^ z; 099 return (s ^ (s << 19 | s >>> 13) ^ (s << 5 | s >>> 27) ^ 0xD1B54A35) * 0x125493 >>> 22; 100 } 101 102 public static double valueNoise(int seed, double x, double y, double z, double w) 103 { 104 int xFloor = x >= 0 ? (int) x : (int) x - 1; 105 x -= xFloor; 106 x *= x * (3 - 2 * x); 107 int yFloor = y >= 0 ? (int) y : (int) y - 1; 108 y -= yFloor; 109 y *= y * (3 - 2 * y); 110 int zFloor = z >= 0 ? (int) z : (int) z - 1; 111 z -= zFloor; 112 z *= z * (3 - 2 * z); 113 int wFloor = w >= 0 ? (int) w : (int) w - 1; 114 w -= wFloor; 115 w *= w * (3 - 2 * w); 116 //0xE19B1, 0xC6D1D, 0xAF36D, 0x9A695 117 xFloor *= 0xE19B1; 118 yFloor *= 0xC6D1D; 119 zFloor *= 0xAF36D; 120 wFloor *= 0x9A695; 121 return ((1 - w) * 122 ((1 - z) * 123 ((1 - y) * ((1 - x) * hashPart1024(xFloor, yFloor, zFloor, wFloor, seed) + x * hashPart1024(xFloor + 0xE19B1, yFloor, zFloor, wFloor, seed)) 124 + y * ((1 - x) * hashPart1024(xFloor, yFloor + 0xC6D1D, zFloor, wFloor, seed) + x * hashPart1024(xFloor + 0xE19B1, yFloor + 0xC6D1D, zFloor, wFloor, seed))) 125 + z * 126 ((1 - y) * ((1 - x) * hashPart1024(xFloor, yFloor, zFloor + 0xAF36D, wFloor, seed) + x * hashPart1024(xFloor + 0xE19B1, yFloor, zFloor + 0xAF36D, wFloor, seed)) 127 + y * ((1 - x) * hashPart1024(xFloor, yFloor + 0xC6D1D, zFloor + 0xAF36D, wFloor, seed) + x * hashPart1024(xFloor + 0xE19B1, yFloor + 0xC6D1D, zFloor + 0xAF36D, wFloor, seed)))) 128 + (w * 129 ((1 - z) * 130 ((1 - y) * ((1 - x) * hashPart1024(xFloor, yFloor, zFloor, wFloor + 0x9A695, seed) + x * hashPart1024(xFloor + 0xE19B1, yFloor, zFloor, wFloor + 0x9A695, seed)) 131 + y * ((1 - x) * hashPart1024(xFloor, yFloor + 0xC6D1D, zFloor, wFloor + 0x9A695, seed) + x * hashPart1024(xFloor + 0xE19B1, yFloor + 0xC6D1D, zFloor, wFloor + 0x9A695, seed))) 132 + z * 133 ((1 - y) * ((1 - x) * hashPart1024(xFloor, yFloor, zFloor + 0xAF36D, wFloor + 0x9A695, seed) + x * hashPart1024(xFloor + 0xE19B1, yFloor, zFloor + 0xAF36D, wFloor + 0x9A695, seed)) 134 + y * ((1 - x) * hashPart1024(xFloor, yFloor + 0xC6D1D, zFloor + 0xAF36D, wFloor + 0x9A695, seed) + x * hashPart1024(xFloor + 0xE19B1, yFloor + 0xC6D1D, zFloor + 0xAF36D, wFloor + 0x9A695, seed))) 135 ))) * (0x1.0040100401004p-10); 136 } 137 138 //// constants are the most significant 20 bits of constants from PhantomNoise, incremented if even 139 //// they should normally be used for the 5D version of R2, but we only use 4 of the 5 constants 140 //x should be premultiplied by 0xE19B1 141 //y should be premultiplied by 0xC6D1D 142 //z should be premultiplied by 0xAF36D 143 //w should be premultiplied by 0x9A695 144 private static int hashPart1024(final int x, final int y, final int z, final int w, int s) { 145 s += x ^ y ^ z ^ w; 146 return (s ^ (s << 19 | s >>> 13) ^ (s << 5 | s >>> 27) ^ 0xD1B54A35) * 0x125493 >>> 22; 147 } 148 149 public static double valueNoise(int seed, double x, double y, double z, double w, double u, double v) 150 { 151 int xFloor = x >= 0 ? (int) x : (int) x - 1; 152 x -= xFloor; 153 x *= x * (3 - 2 * x); 154 int yFloor = y >= 0 ? (int) y : (int) y - 1; 155 y -= yFloor; 156 y *= y * (3 - 2 * y); 157 int zFloor = z >= 0 ? (int) z : (int) z - 1; 158 z -= zFloor; 159 z *= z * (3 - 2 * z); 160 int wFloor = w >= 0 ? (int) w : (int) w - 1; 161 w -= wFloor; 162 w *= w * (3 - 2 * w); 163 int uFloor = u >= 0 ? (int) u : (int) u - 1; 164 u -= uFloor; 165 u *= u * (3 - 2 * u); 166 int vFloor = v >= 0 ? (int) v : (int) v - 1; 167 v -= vFloor; 168 v *= v * (3 - 2 * v); 169 //0xE95E1, 0xD4BC7, 0xC1EDB, 0xB0C8B, 0xA1279, 0x92E85 170 xFloor *= 0xE95E1; 171 yFloor *= 0xD4BC7; 172 zFloor *= 0xC1EDB; 173 wFloor *= 0xB0C8B; 174 uFloor *= 0xA127B; 175 vFloor *= 0x92E85; 176 return ((1 - v) * 177 ((1 - u) * 178 ((1 - w) * 179 ((1 - z) * 180 ((1 - y) * ((1 - x) * hashPart1024(xFloor, yFloor, zFloor, wFloor, uFloor, vFloor, seed) + x * hashPart1024(xFloor + 0xE95E1, yFloor, zFloor, wFloor, uFloor, vFloor, seed)) 181 + y * ((1 - x) * hashPart1024(xFloor, yFloor + 0xD4BC7, zFloor, wFloor, uFloor, vFloor, seed) + x * hashPart1024(xFloor + 0xE95E1, yFloor + 0xD4BC7, zFloor, wFloor, uFloor, vFloor, seed))) 182 + z * 183 ((1 - y) * ((1 - x) * hashPart1024(xFloor, yFloor, zFloor + 0xC1EDB, wFloor, uFloor, vFloor, seed) + x * hashPart1024(xFloor + 0xE95E1, yFloor, zFloor + 0xC1EDB, wFloor, uFloor, vFloor, seed)) 184 + y * ((1 - x) * hashPart1024(xFloor, yFloor + 0xD4BC7, zFloor + 0xC1EDB, wFloor, uFloor, vFloor, seed) + x * hashPart1024(xFloor + 0xE95E1, yFloor + 0xD4BC7, zFloor + 0xC1EDB, wFloor, uFloor, vFloor, seed)))) 185 + (w * 186 ((1 - z) * 187 ((1 - y) * ((1 - x) * hashPart1024(xFloor, yFloor, zFloor, wFloor + 0xB0C8B, uFloor, vFloor, seed) + x * hashPart1024(xFloor + 0xE95E1, yFloor, zFloor, wFloor + 0xB0C8B, uFloor, vFloor, seed)) 188 + y * ((1 - x) * hashPart1024(xFloor, yFloor + 0xD4BC7, zFloor, wFloor + 0xB0C8B, uFloor, vFloor, seed) + x * hashPart1024(xFloor + 0xE95E1, yFloor + 0xD4BC7, zFloor, wFloor + 0xB0C8B, uFloor, vFloor, seed))) 189 + z * 190 ((1 - y) * ((1 - x) * hashPart1024(xFloor, yFloor, zFloor + 0xC1EDB, wFloor + 0xB0C8B, uFloor, vFloor, seed) + x * hashPart1024(xFloor + 0xE95E1, yFloor, zFloor + 0xC1EDB, wFloor + 0xB0C8B, uFloor, vFloor, seed)) 191 + y * ((1 - x) * hashPart1024(xFloor, yFloor + 0xD4BC7, zFloor + 0xC1EDB, wFloor + 0xB0C8B, uFloor, vFloor, seed) + x * hashPart1024(xFloor + 0xE95E1, yFloor + 0xD4BC7, zFloor + 0xC1EDB, wFloor + 0xB0C8B, uFloor, vFloor, seed))) 192 ))) 193 + (u * 194 ((1 - w) * 195 ((1 - z) * 196 ((1 - y) * ((1 - x) * hashPart1024(xFloor, yFloor, zFloor, wFloor, uFloor + 0xA127B, vFloor, seed) + x * hashPart1024(xFloor + 0xE95E1, yFloor, zFloor, wFloor, uFloor + 0xA127B, vFloor, seed)) 197 + y * ((1 - x) * hashPart1024(xFloor, yFloor + 0xD4BC7, zFloor, wFloor, uFloor + 0xA127B, vFloor, seed) + x * hashPart1024(xFloor + 0xE95E1, yFloor + 0xD4BC7, zFloor, wFloor, uFloor + 0xA127B, vFloor, seed))) 198 + z * 199 ((1 - y) * ((1 - x) * hashPart1024(xFloor, yFloor, zFloor + 0xC1EDB, wFloor, uFloor + 0xA127B, vFloor, seed) + x * hashPart1024(xFloor + 0xE95E1, yFloor, zFloor + 0xC1EDB, wFloor, uFloor + 0xA127B, vFloor, seed)) 200 + y * ((1 - x) * hashPart1024(xFloor, yFloor + 0xD4BC7, zFloor + 0xC1EDB, wFloor, uFloor + 0xA127B, vFloor, seed) + x * hashPart1024(xFloor + 0xE95E1, yFloor + 0xD4BC7, zFloor + 0xC1EDB, wFloor, uFloor + 0xA127B, vFloor, seed)))) 201 + (w * 202 ((1 - z) * 203 ((1 - y) * ((1 - x) * hashPart1024(xFloor, yFloor, zFloor, wFloor + 0xB0C8B, uFloor + 0xA127B, vFloor, seed) + x * hashPart1024(xFloor + 0xE95E1, yFloor, zFloor, wFloor + 0xB0C8B, uFloor + 0xA127B, vFloor, seed)) 204 + y * ((1 - x) * hashPart1024(xFloor, yFloor + 0xD4BC7, zFloor, wFloor + 0xB0C8B, uFloor + 0xA127B, vFloor, seed) + x * hashPart1024(xFloor + 0xE95E1, yFloor + 0xD4BC7, zFloor, wFloor + 0xB0C8B, uFloor + 0xA127B, vFloor, seed))) 205 + z * 206 ((1 - y) * ((1 - x) * hashPart1024(xFloor, yFloor, zFloor + 0xC1EDB, wFloor + 0xB0C8B, uFloor + 0xA127B, vFloor, seed) + x * hashPart1024(xFloor + 0xE95E1, yFloor, zFloor + 0xC1EDB, wFloor + 0xB0C8B, uFloor + 0xA127B, vFloor, seed)) 207 + y * ((1 - x) * hashPart1024(xFloor, yFloor + 0xD4BC7, zFloor + 0xC1EDB, wFloor + 0xB0C8B, uFloor + 0xA127B, vFloor, seed) + x * hashPart1024(xFloor + 0xE95E1, yFloor + 0xD4BC7, zFloor + 0xC1EDB, wFloor + 0xB0C8B, uFloor + 0xA127B, vFloor, seed))) 208 ))))) 209 + (v * 210 ((1 - u) * 211 ((1 - w) * 212 ((1 - z) * 213 ((1 - y) * ((1 - x) * hashPart1024(xFloor, yFloor, zFloor, wFloor, uFloor, vFloor + 0x92E85, seed) + x * hashPart1024(xFloor + 0xE95E1, yFloor, zFloor, wFloor, uFloor, vFloor + 0x92E85, seed)) 214 + y * ((1 - x) * hashPart1024(xFloor, yFloor + 0xD4BC7, zFloor, wFloor, uFloor, vFloor + 0x92E85, seed) + x * hashPart1024(xFloor + 0xE95E1, yFloor + 0xD4BC7, zFloor, wFloor, uFloor, vFloor + 0x92E85, seed))) 215 + z * 216 ((1 - y) * ((1 - x) * hashPart1024(xFloor, yFloor, zFloor + 0xC1EDB, wFloor, uFloor, vFloor + 0x92E85, seed) + x * hashPart1024(xFloor + 0xE95E1, yFloor, zFloor + 0xC1EDB, wFloor, uFloor, vFloor + 0x92E85, seed)) 217 + y * ((1 - x) * hashPart1024(xFloor, yFloor + 0xD4BC7, zFloor + 0xC1EDB, wFloor, uFloor, vFloor + 0x92E85, seed) + x * hashPart1024(xFloor + 0xE95E1, yFloor + 0xD4BC7, zFloor + 0xC1EDB, wFloor, uFloor, vFloor + 0x92E85, seed)))) 218 + (w * 219 ((1 - z) * 220 ((1 - y) * ((1 - x) * hashPart1024(xFloor, yFloor, zFloor, wFloor + 0xB0C8B, uFloor, vFloor + 0x92E85, seed) + x * hashPart1024(xFloor + 0xE95E1, yFloor, zFloor, wFloor + 0xB0C8B, uFloor, vFloor + 0x92E85, seed)) 221 + y * ((1 - x) * hashPart1024(xFloor, yFloor + 0xD4BC7, zFloor, wFloor + 0xB0C8B, uFloor, vFloor + 0x92E85, seed) + x * hashPart1024(xFloor + 0xE95E1, yFloor + 0xD4BC7, zFloor, wFloor + 0xB0C8B, uFloor, vFloor + 0x92E85, seed))) 222 + z * 223 ((1 - y) * ((1 - x) * hashPart1024(xFloor, yFloor, zFloor + 0xC1EDB, wFloor + 0xB0C8B, uFloor, vFloor + 0x92E85, seed) + x * hashPart1024(xFloor + 0xE95E1, yFloor, zFloor + 0xC1EDB, wFloor + 0xB0C8B, uFloor, vFloor + 0x92E85, seed)) 224 + y * ((1 - x) * hashPart1024(xFloor, yFloor + 0xD4BC7, zFloor + 0xC1EDB, wFloor + 0xB0C8B, uFloor, vFloor + 0x92E85, seed) + x * hashPart1024(xFloor + 0xE95E1, yFloor + 0xD4BC7, zFloor + 0xC1EDB, wFloor + 0xB0C8B, uFloor, vFloor + 0x92E85, seed))) 225 ))) 226 + (u * 227 ((1 - w) * 228 ((1 - z) * 229 ((1 - y) * ((1 - x) * hashPart1024(xFloor, yFloor, zFloor, wFloor, uFloor + 0xA127B, vFloor + 0x92E85, seed) + x * hashPart1024(xFloor + 0xE95E1, yFloor, zFloor, wFloor, uFloor + 0xA127B, vFloor + 0x92E85, seed)) 230 + y * ((1 - x) * hashPart1024(xFloor, yFloor + 0xD4BC7, zFloor, wFloor, uFloor + 0xA127B, vFloor + 0x92E85, seed) + x * hashPart1024(xFloor + 0xE95E1, yFloor + 0xD4BC7, zFloor, wFloor, uFloor + 0xA127B, vFloor + 0x92E85, seed))) 231 + z * 232 ((1 - y) * ((1 - x) * hashPart1024(xFloor, yFloor, zFloor + 0xC1EDB, wFloor, uFloor + 0xA127B, vFloor + 0x92E85, seed) + x * hashPart1024(xFloor + 0xE95E1, yFloor, zFloor + 0xC1EDB, wFloor, uFloor + 0xA127B, vFloor + 0x92E85, seed)) 233 + y * ((1 - x) * hashPart1024(xFloor, yFloor + 0xD4BC7, zFloor + 0xC1EDB, wFloor, uFloor + 0xA127B, vFloor + 0x92E85, seed) + x * hashPart1024(xFloor + 0xE95E1, yFloor + 0xD4BC7, zFloor + 0xC1EDB, wFloor, uFloor + 0xA127B, vFloor + 0x92E85, seed)))) 234 + (w * 235 ((1 - z) * 236 ((1 - y) * ((1 - x) * hashPart1024(xFloor, yFloor, zFloor, wFloor + 0xB0C8B, uFloor + 0xA127B, vFloor + 0x92E85, seed) + x * hashPart1024(xFloor + 0xE95E1, yFloor, zFloor, wFloor + 0xB0C8B, uFloor + 0xA127B, vFloor + 0x92E85, seed)) 237 + y * ((1 - x) * hashPart1024(xFloor, yFloor + 0xD4BC7, zFloor, wFloor + 0xB0C8B, uFloor + 0xA127B, vFloor + 0x92E85, seed) + x * hashPart1024(xFloor + 0xE95E1, yFloor + 0xD4BC7, zFloor, wFloor + 0xB0C8B, uFloor + 0xA127B, vFloor + 0x92E85, seed))) 238 + z * 239 ((1 - y) * ((1 - x) * hashPart1024(xFloor, yFloor, zFloor + 0xC1EDB, wFloor + 0xB0C8B, uFloor + 0xA127B, vFloor + 0x92E85, seed) + x * hashPart1024(xFloor + 0xE95E1, yFloor, zFloor + 0xC1EDB, wFloor + 0xB0C8B, uFloor + 0xA127B, vFloor + 0x92E85, seed)) 240 + y * ((1 - x) * hashPart1024(xFloor, yFloor + 0xD4BC7, zFloor + 0xC1EDB, wFloor + 0xB0C8B, uFloor + 0xA127B, vFloor + 0x92E85, seed) + x * hashPart1024(xFloor + 0xE95E1, yFloor + 0xD4BC7, zFloor + 0xC1EDB, wFloor + 0xB0C8B, uFloor + 0xA127B, vFloor + 0x92E85, seed))) 241 )))))) 242 ) * (0x1.0040100401004p-10); 243 } 244 245 //// constants are the most significant 20 bits of constants from PhantomNoise, incremented if even 246 //// they should normally be used for the 7D version of R2, but we only use 6 of the 7 constants 247 //x should be premultiplied by 0xE95E1 248 //y should be premultiplied by 0xD4BC7 249 //z should be premultiplied by 0xC1EDB 250 //w should be premultiplied by 0xB0C8B 251 //u should be premultiplied by 0xA127B 252 //v should be premultiplied by 0x92E85 253 private static int hashPart1024(final int x, final int y, final int z, final int w, final int u, final int v, int s) { 254 s += x ^ y ^ z ^ w ^ u ^ v; 255 return (s ^ (s << 19 | s >>> 13) ^ (s << 5 | s >>> 27) ^ 0xD1B54A35) * 0x125493 >>> 22; 256 } 257 258 @Override 259 public double getNoise(double x) { 260 return valueNoise(seed, x) * 2 - 1; 261 } 262 263 @Override 264 public double getNoiseWithSeed(double x, long seed) { 265 return valueNoise((int) (seed ^ seed >>> 32), x) * 2 - 1; 266 } 267 268 @Override 269 public double getNoise(double x, double y) { 270 return valueNoise(seed, x, y) * 2 - 1; 271 } 272 @Override 273 public double getNoiseWithSeed(double x, double y, long seed) { 274 return valueNoise((int) (seed ^ seed >>> 32), x, y) * 2 - 1; 275 } 276 @Override 277 public double getNoise(double x, double y, double z) { 278 return valueNoise(seed, x, y, z) * 2 - 1; 279 } 280 @Override 281 public double getNoiseWithSeed(double x, double y, double z, long seed) { 282 return valueNoise((int) (seed ^ seed >>> 32), x, y, z) * 2 - 1; 283 } 284 @Override 285 public double getNoise(double x, double y, double z, double w) { 286 return valueNoise(seed, x, y, z, w) * 2 - 1; 287 } 288 @Override 289 public double getNoiseWithSeed(double x, double y, double z, double w, long seed) { 290 return valueNoise((int) (seed ^ seed >>> 32), x, y, z, w) * 2 - 1; 291 } 292}