Class IntPointHash

java.lang.Object
com.github.yellowstonegames.grid.IPointHash.IntImpl
com.github.yellowstonegames.grid.IntPointHash
All Implemented Interfaces:
IPointHash

public final class IntPointHash extends IPointHash.IntImpl
A group of similar methods for getting hashes of points based on int coordinates in 2, 3, 4, or 6 dimensions and an int for state; the code is similar to LongPointHash but will be much faster on GWT. This hash has high enough quality to be useful as a source of random numbers based on positions. Even on a desktop JVM, this class is faster than LongPointHash. The technique used here owes credit to Pelle Evensen for finding the significant quality increase from using multiple bitwise rotations XORed together, and Martin Roberts for discovering the connection between higher dimensional ranks and the appropriate numbers to gain similar qualities to adding the golden ratio mod 1 in 1D, using what had already been named "harmonious numbers." The only case where this can return different results on GWT than on a desktop or mobile JVM is when the inputs are GWT-specific out-of-range JS Numbers appearing to be ints, and that's a problem with the input rather than the algorithm.
Getting the bottom 24 bits of hashAll(int, int, int), dividing to get a float from 0 to 1, and graphing it produces this white-noise-like image. The frequency magnitude of that image is this diagram, which looks almost exactly like a diagram of the frequency magnitude of white noise. This shows there are effectively no significant structural artifacts in the noise when interpreted as a float.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface IPointHash

    IPointHash.IntImpl, IPointHash.LongImpl
  • Field Summary

    Fields inherited from class IPointHash.IntImpl

    state
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    IntPointHash(int state)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    static int
    hash256(int x, int y, int s)
    A 8-bit point hash that smashes x and y into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it.
    static int
    hash256(int x, int y, int z, int s)
    A 8-bit point hash that smashes x, y, and z into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it.
    static int
    hash256(int x, int y, int z, int w, int s)
    A 8-bit point hash that smashes x, y, z, and w into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it.
    static int
    hash256(int x, int y, int z, int w, int u, int s)
    An 8-bit point hash that smashes x, y, z, w, and u into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it.
    static int
    hash256(int x, int y, int z, int w, int u, int v, int s)
    A 8-bit point hash that smashes x, y, z, w, u, and v into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it.
    static int
    hash256(int x, int y, int z, int w, int u, int v, int m, int s)
    A 8-bit point hash that smashes x, y, z, w, u, v, and m into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it.
    static int
    hash32(int x, int y, int s)
    A 5-bit point hash that smashes x and y into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it.
    static int
    hash32(int x, int y, int z, int s)
    A 5-bit point hash that smashes x, y, and z into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it.
    static int
    hash32(int x, int y, int z, int w, int s)
    A 5-bit point hash that smashes x, y, z, and w into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it.
    static int
    hash32(int x, int y, int z, int w, int u, int s)
    A 5-bit point hash that smashes x, y, z, w, and u into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it.
    static int
    hash32(int x, int y, int z, int w, int u, int v, int s)
    A 5-bit point hash that smashes x, y, z, w, u, and v into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it.
    static int
    hash32(int x, int y, int z, int w, int u, int v, int m, int s)
    A 5-bit point hash that smashes x, y, z, w, u, v, and m into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it.
    static int
    hash64(int x, int y, int s)
    A 6-bit point hash that smashes x and y into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it.
    static int
    hash64(int x, int y, int z, int s)
    A 6-bit point hash that smashes x, y, and z into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it.
    static int
    hash64(int x, int y, int z, int w, int s)
    A 6-bit point hash that smashes x, y, z, and w into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it.
    static int
    hash64(int x, int y, int z, int w, int u, int s)
    A 6-bit point hash that smashes x, y, z, w, and u into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it.
    static int
    hash64(int x, int y, int z, int w, int u, int v, int s)
    A 6-bit point hash that smashes x, y, z, w, u, and v into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it.
    static int
    hash64(int x, int y, int z, int w, int u, int v, int m, int s)
    A 6-bit point hash that smashes x, y, z, w, u, v, and m into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it.
    static int
    hashAll(int x, int y, int s)
    A 32-bit point hash that smashes x and y into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it.
    static int
    hashAll(int x, int y, int z, int s)
    A 32-bit point hash that smashes x, y, and z into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it.
    static int
    hashAll(int x, int y, int z, int w, int s)
    A 32-bit point hash that smashes x, y, z, and w into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it.
    static int
    hashAll(int x, int y, int z, int w, int u, int s)
    A 32-bit point hash that smashes x, y, z, w, and u into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it.
    static int
    hashAll(int x, int y, int z, int w, int u, int v, int s)
    A 32-bit point hash that smashes x, y, z, w, u, and v into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it.
    static int
    hashAll(int x, int y, int z, int w, int u, int v, int m, int s)
    A 32-bit point hash that smashes x, y, z, w, u, v, and m into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it.
    int
    hashWithState(int x, int y, int state)
     
    int
    hashWithState(int x, int y, int z, int state)
     
    int
    hashWithState(int x, int y, int z, int w, int state)
     
    int
    hashWithState(int x, int y, int z, int w, int u, int state)
     
    int
    hashWithState(int x, int y, int z, int w, int u, int v, int state)
     
    int
    hashWithState(int x, int y, int z, int w, int u, int v, int m, int state)
     

    Methods inherited from class IPointHash.IntImpl

    hash, hash, hash, hash, hash, setState

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • IntPointHash

      public IntPointHash()
    • IntPointHash

      public IntPointHash(int state)
  • Method Details

    • getState

      public int getState()
    • hashWithState

      public int hashWithState(int x, int y, int state)
    • hashWithState

      public int hashWithState(int x, int y, int z, int state)
    • hashWithState

      public int hashWithState(int x, int y, int z, int w, int state)
    • hashWithState

      public int hashWithState(int x, int y, int z, int w, int u, int state)
    • hashWithState

      public int hashWithState(int x, int y, int z, int w, int u, int v, int state)
    • hashWithState

      public int hashWithState(int x, int y, int z, int w, int u, int v, int m, int state)
    • hashAll

      public static int hashAll(int x, int y, int s)
      A 32-bit point hash that smashes x and y into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it. Has better performance than HastyPointHash, especially for ints, and has slightly fewer collisions in a hash table of points. GWT-optimized. Inspired by Pelle Evensen's rrxmrrxmsx_0 unary hash, though this doesn't use its code or its full algorithm. The unary hash used here has been stripped down heavily, both for speed and because unless points are selected specifically to target flaws in the hash, it doesn't need the intense resistance to bad inputs that rrxmrrxmsx_0 has.
      Parameters:
      x - x position, as an int
      y - y position, as an int
      s - any int, a seed to be able to produce many hashes for a given point
      Returns:
      32-bit hash of the x,y point with the given state s
    • hashAll

      public static int hashAll(int x, int y, int z, int s)
      A 32-bit point hash that smashes x, y, and z into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it. Has better performance than HastyPointHash, especially for ints, and has slightly fewer collisions in a hash table of points. GWT-optimized. Inspired by Pelle Evensen's rrxmrrxmsx_0 unary hash, though this doesn't use its code or its full algorithm. The unary hash used here has been stripped down heavily, both for speed and because unless points are selected specifically to target flaws in the hash, it doesn't need the intense resistance to bad inputs that rrxmrrxmsx_0 has.
      Parameters:
      x - x position, as an int
      y - y position, as an int
      z - z position, as an int
      s - any int, a seed to be able to produce many hashes for a given point
      Returns:
      32-bit hash of the x,y,z point with the given state s
    • hashAll

      public static int hashAll(int x, int y, int z, int w, int s)
      A 32-bit point hash that smashes x, y, z, and w into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it. Has better performance than HastyPointHash, especially for ints, and has slightly fewer collisions in a hash table of points. GWT-optimized. Inspired by Pelle Evensen's rrxmrrxmsx_0 unary hash, though this doesn't use its code or its full algorithm. The unary hash used here has been stripped down heavily, both for speed and because unless points are selected specifically to target flaws in the hash, it doesn't need the intense resistance to bad inputs that rrxmrrxmsx_0 has.
      Parameters:
      x - x position, as an int
      y - y position, as an int
      z - z position, as an int
      w - w position, as an int
      s - any int, a seed to be able to produce many hashes for a given point
      Returns:
      32-bit hash of the x,y,z,w point with the given state s
    • hashAll

      public static int hashAll(int x, int y, int z, int w, int u, int s)
      A 32-bit point hash that smashes x, y, z, w, and u into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it. GWT-optimized. Inspired by Pelle Evensen's rrxmrrxmsx_0 unary hash, though this doesn't use its code or its full algorithm. The unary hash used here has been stripped down heavily, both for speed and because unless points are selected specifically to target flaws in the hash, it doesn't need the intense resistance to bad inputs that rrxmrrxmsx_0 has.
      Parameters:
      x - x position, as an int
      y - y position, as an int
      z - z position, as an int
      w - w position, as an int
      u - u position, as an int
      s - any int, a seed to be able to produce many hashes for a given point
      Returns:
      32-bit hash of the x,y,z,w,u point with the given state s
    • hashAll

      public static int hashAll(int x, int y, int z, int w, int u, int v, int s)
      A 32-bit point hash that smashes x, y, z, w, u, and v into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it. GWT-optimized. Inspired by Pelle Evensen's rrxmrrxmsx_0 unary hash, though this doesn't use its code or its full algorithm. The unary hash used here has been stripped down heavily, both for speed and because unless points are selected specifically to target flaws in the hash, it doesn't need the intense resistance to bad inputs that rrxmrrxmsx_0 has.
      Parameters:
      x - x position, as an int
      y - y position, as an int
      z - z position, as an int
      w - w position, as an int
      u - u position, as an int
      v - v position, as an int
      s - any int, a seed to be able to produce many hashes for a given point
      Returns:
      32-bit hash of the x,y,z,w,u,v point with the given state s
    • hashAll

      public static int hashAll(int x, int y, int z, int w, int u, int v, int m, int s)
      A 32-bit point hash that smashes x, y, z, w, u, v, and m into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it. GWT-optimized. Inspired by Pelle Evensen's rrxmrrxmsx_0 unary hash, though this doesn't use its code or its full algorithm. The unary hash used here has been stripped down heavily, both for speed and because unless points are selected specifically to target flaws in the hash, it doesn't need the intense resistance to bad inputs that rrxmrrxmsx_0 has.
      Parameters:
      x - x position, as an int
      y - y position, as an int
      z - z position, as an int
      w - w position, as an int
      u - u position, as an int
      v - v position, as an int
      m - m position, as an int
      s - any int, a seed to be able to produce many hashes for a given point
      Returns:
      32-bit hash of the x,y,z,w,u,v,m point with the given state s
    • hash256

      public static int hash256(int x, int y, int s)
      A 8-bit point hash that smashes x and y into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it. Has better performance than HastyPointHash, especially for ints, and has slightly fewer collisions in a hash table of points. GWT-optimized. Inspired by Pelle Evensen's rrxmrrxmsx_0 unary hash, though this doesn't use its code or its full algorithm. The unary hash used here has been stripped down heavily, both for speed and because unless points are selected specifically to target flaws in the hash, it doesn't need the intense resistance to bad inputs that rrxmrrxmsx_0 has.
      Parameters:
      x - x position, as an int
      y - y position, as an int
      s - any int, a seed to be able to produce many hashes for a given point
      Returns:
      8-bit hash of the x,y point with the given state s
    • hash256

      public static int hash256(int x, int y, int z, int s)
      A 8-bit point hash that smashes x, y, and z into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it. Has better performance than HastyPointHash, especially for ints, and has slightly fewer collisions in a hash table of points. GWT-optimized. Inspired by Pelle Evensen's rrxmrrxmsx_0 unary hash, though this doesn't use its code or its full algorithm. The unary hash used here has been stripped down heavily, both for speed and because unless points are selected specifically to target flaws in the hash, it doesn't need the intense resistance to bad inputs that rrxmrrxmsx_0 has.
      Parameters:
      x - x position, as an int
      y - y position, as an int
      z - z position, as an int
      s - any int, a seed to be able to produce many hashes for a given point
      Returns:
      8-bit hash of the x,y,z point with the given state s
    • hash256

      public static int hash256(int x, int y, int z, int w, int s)
      A 8-bit point hash that smashes x, y, z, and w into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it. Has better performance than HastyPointHash, especially for ints, and has slightly fewer collisions in a hash table of points. GWT-optimized. Inspired by Pelle Evensen's rrxmrrxmsx_0 unary hash, though this doesn't use its code or its full algorithm. The unary hash used here has been stripped down heavily, both for speed and because unless points are selected specifically to target flaws in the hash, it doesn't need the intense resistance to bad inputs that rrxmrrxmsx_0 has.
      Parameters:
      x - x position, as an int
      y - y position, as an int
      z - z position, as an int
      w - w position, as an int
      s - any int, a seed to be able to produce many hashes for a given point
      Returns:
      8-bit hash of the x,y,z,w point with the given state s
    • hash256

      public static int hash256(int x, int y, int z, int w, int u, int s)
      An 8-bit point hash that smashes x, y, z, w, and u into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it. GWT-optimized. Inspired by Pelle Evensen's rrxmrrxmsx_0 unary hash, though this doesn't use its code or its full algorithm. The unary hash used here has been stripped down heavily, both for speed and because unless points are selected specifically to target flaws in the hash, it doesn't need the intense resistance to bad inputs that rrxmrrxmsx_0 has.
      Parameters:
      x - x position, as an int
      y - y position, as an int
      z - z position, as an int
      w - w position, as an int
      u - u position, as an int
      s - any int, a seed to be able to produce many hashes for a given point
      Returns:
      8-bit hash of the x,y,z,w,u point with the given state s
    • hash256

      public static int hash256(int x, int y, int z, int w, int u, int v, int s)
      A 8-bit point hash that smashes x, y, z, w, u, and v into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it. GWT-optimized. Inspired by Pelle Evensen's rrxmrrxmsx_0 unary hash, though this doesn't use its code or its full algorithm. The unary hash used here has been stripped down heavily, both for speed and because unless points are selected specifically to target flaws in the hash, it doesn't need the intense resistance to bad inputs that rrxmrrxmsx_0 has.
      Parameters:
      x - x position, as an int
      y - y position, as an int
      z - z position, as an int
      w - w position, as an int
      u - u position, as an int
      v - v position, as an int
      s - any int, a seed to be able to produce many hashes for a given point
      Returns:
      8-bit hash of the x,y,z,w,u,v point with the given state s
    • hash256

      public static int hash256(int x, int y, int z, int w, int u, int v, int m, int s)
      A 8-bit point hash that smashes x, y, z, w, u, v, and m into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it. GWT-optimized. Inspired by Pelle Evensen's rrxmrrxmsx_0 unary hash, though this doesn't use its code or its full algorithm. The unary hash used here has been stripped down heavily, both for speed and because unless points are selected specifically to target flaws in the hash, it doesn't need the intense resistance to bad inputs that rrxmrrxmsx_0 has.
      Parameters:
      x - x position, as an int
      y - y position, as an int
      z - z position, as an int
      w - w position, as an int
      u - u position, as an int
      v - v position, as an int
      m - m position, as an int
      s - any int, a seed to be able to produce many hashes for a given point
      Returns:
      8-bit hash of the x,y,z,w,u,v,m point with the given state s
    • hash64

      public static int hash64(int x, int y, int s)
      A 6-bit point hash that smashes x and y into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it. Has better performance than HastyPointHash, especially for ints, and has slightly fewer collisions in a hash table of points. GWT-optimized. Inspired by Pelle Evensen's rrxmrrxmsx_0 unary hash, though this doesn't use its code or its full algorithm. The unary hash used here has been stripped down heavily, both for speed and because unless points are selected specifically to target flaws in the hash, it doesn't need the intense resistance to bad inputs that rrxmrrxmsx_0 has.
      Parameters:
      x - x position, as an int
      y - y position, as an int
      s - any int, a seed to be able to produce many hashes for a given point
      Returns:
      6-bit hash of the x,y point with the given state s
    • hash64

      public static int hash64(int x, int y, int z, int s)
      A 6-bit point hash that smashes x, y, and z into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it. Has better performance than HastyPointHash, especially for ints, and has slightly fewer collisions in a hash table of points. GWT-optimized. Inspired by Pelle Evensen's rrxmrrxmsx_0 unary hash, though this doesn't use its code or its full algorithm. The unary hash used here has been stripped down heavily, both for speed and because unless points are selected specifically to target flaws in the hash, it doesn't need the intense resistance to bad inputs that rrxmrrxmsx_0 has.
      Parameters:
      x - x position, as an int
      y - y position, as an int
      z - z position, as an int
      s - any int, a seed to be able to produce many hashes for a given point
      Returns:
      6-bit hash of the x,y,z point with the given state s
    • hash64

      public static int hash64(int x, int y, int z, int w, int s)
      A 6-bit point hash that smashes x, y, z, and w into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it. Has better performance than HastyPointHash, especially for ints, and has slightly fewer collisions in a hash table of points. GWT-optimized. Inspired by Pelle Evensen's rrxmrrxmsx_0 unary hash, though this doesn't use its code or its full algorithm. The unary hash used here has been stripped down heavily, both for speed and because unless points are selected specifically to target flaws in the hash, it doesn't need the intense resistance to bad inputs that rrxmrrxmsx_0 has.
      Parameters:
      x - x position, as an int
      y - y position, as an int
      z - z position, as an int
      w - w position, as an int
      s - any int, a seed to be able to produce many hashes for a given point
      Returns:
      6-bit hash of the x,y,z,w point with the given state s
    • hash64

      public static int hash64(int x, int y, int z, int w, int u, int s)
      A 6-bit point hash that smashes x, y, z, w, and u into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it. GWT-optimized. Inspired by Pelle Evensen's rrxmrrxmsx_0 unary hash, though this doesn't use its code or its full algorithm. The unary hash used here has been stripped down heavily, both for speed and because unless points are selected specifically to target flaws in the hash, it doesn't need the intense resistance to bad inputs that rrxmrrxmsx_0 has.
      Parameters:
      x - x position, as an int
      y - y position, as an int
      z - z position, as an int
      w - w position, as an int
      u - u position, as an int
      s - any int, a seed to be able to produce many hashes for a given point
      Returns:
      6-bit hash of the x,y,z,w,u point with the given state s
    • hash64

      public static int hash64(int x, int y, int z, int w, int u, int v, int s)
      A 6-bit point hash that smashes x, y, z, w, u, and v into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it. GWT-optimized. Inspired by Pelle Evensen's rrxmrrxmsx_0 unary hash, though this doesn't use its code or its full algorithm. The unary hash used here has been stripped down heavily, both for speed and because unless points are selected specifically to target flaws in the hash, it doesn't need the intense resistance to bad inputs that rrxmrrxmsx_0 has.
      Parameters:
      x - x position, as an int
      y - y position, as an int
      z - z position, as an int
      w - w position, as an int
      u - u position, as an int
      v - v position, as an int
      s - any int, a seed to be able to produce many hashes for a given point
      Returns:
      6-bit hash of the x,y,z,w,u,v point with the given state s
    • hash64

      public static int hash64(int x, int y, int z, int w, int u, int v, int m, int s)
      A 6-bit point hash that smashes x, y, z, w, u, v, and m into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it. GWT-optimized. Inspired by Pelle Evensen's rrxmrrxmsx_0 unary hash, though this doesn't use its code or its full algorithm. The unary hash used here has been stripped down heavily, both for speed and because unless points are selected specifically to target flaws in the hash, it doesn't need the intense resistance to bad inputs that rrxmrrxmsx_0 has.
      Parameters:
      x - x position, as an int
      y - y position, as an int
      z - z position, as an int
      w - w position, as an int
      u - u position, as an int
      v - v position, as an int
      m - m position, as an int
      s - any int, a seed to be able to produce many hashes for a given point
      Returns:
      6-bit hash of the x,y,z,w,u,v,m point with the given state s
    • hash32

      public static int hash32(int x, int y, int s)
      A 5-bit point hash that smashes x and y into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it. Has better performance than HastyPointHash, especially for ints, and has slightly fewer collisions in a hash table of points. GWT-optimized. Inspired by Pelle Evensen's rrxmrrxmsx_0 unary hash, though this doesn't use its code or its full algorithm. The unary hash used here has been stripped down heavily, both for speed and because unless points are selected specifically to target flaws in the hash, it doesn't need the intense resistance to bad inputs that rrxmrrxmsx_0 has.
      Parameters:
      x - x position, as an int
      y - y position, as an int
      s - any int, a seed to be able to produce many hashes for a given point
      Returns:
      5-bit hash of the x,y point with the given state s
    • hash32

      public static int hash32(int x, int y, int z, int s)
      A 5-bit point hash that smashes x, y, and z into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it. Has better performance than HastyPointHash, especially for ints, and has slightly fewer collisions in a hash table of points. GWT-optimized. Inspired by Pelle Evensen's rrxmrrxmsx_0 unary hash, though this doesn't use its code or its full algorithm. The unary hash used here has been stripped down heavily, both for speed and because unless points are selected specifically to target flaws in the hash, it doesn't need the intense resistance to bad inputs that rrxmrrxmsx_0 has.
      Parameters:
      x - x position, as an int
      y - y position, as an int
      z - z position, as an int
      s - any int, a seed to be able to produce many hashes for a given point
      Returns:
      5-bit hash of the x,y,z point with the given state s
    • hash32

      public static int hash32(int x, int y, int z, int w, int s)
      A 5-bit point hash that smashes x, y, z, and w into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it. Has better performance than HastyPointHash, especially for ints, and has slightly fewer collisions in a hash table of points. GWT-optimized. Inspired by Pelle Evensen's rrxmrrxmsx_0 unary hash, though this doesn't use its code or its full algorithm. The unary hash used here has been stripped down heavily, both for speed and because unless points are selected specifically to target flaws in the hash, it doesn't need the intense resistance to bad inputs that rrxmrrxmsx_0 has.
      Parameters:
      x - x position, as an int
      y - y position, as an int
      z - z position, as an int
      w - w position, as an int
      s - any int, a seed to be able to produce many hashes for a given point
      Returns:
      5-bit hash of the x,y,z,w point with the given state s
    • hash32

      public static int hash32(int x, int y, int z, int w, int u, int s)
      A 5-bit point hash that smashes x, y, z, w, and u into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it. GWT-optimized. Inspired by Pelle Evensen's rrxmrrxmsx_0 unary hash, though this doesn't use its code or its full algorithm. The unary hash used here has been stripped down heavily, both for speed and because unless points are selected specifically to target flaws in the hash, it doesn't need the intense resistance to bad inputs that rrxmrrxmsx_0 has.
      Parameters:
      x - x position, as an int
      y - y position, as an int
      z - z position, as an int
      w - w position, as an int
      u - u position, as an int
      s - any int, a seed to be able to produce many hashes for a given point
      Returns:
      5-bit hash of the x,y,z,w,u point with the given state s
    • hash32

      public static int hash32(int x, int y, int z, int w, int u, int v, int s)
      A 5-bit point hash that smashes x, y, z, w, u, and v into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it. GWT-optimized. Inspired by Pelle Evensen's rrxmrrxmsx_0 unary hash, though this doesn't use its code or its full algorithm. The unary hash used here has been stripped down heavily, both for speed and because unless points are selected specifically to target flaws in the hash, it doesn't need the intense resistance to bad inputs that rrxmrrxmsx_0 has.
      Parameters:
      x - x position, as an int
      y - y position, as an int
      z - z position, as an int
      w - w position, as an int
      u - u position, as an int
      v - v position, as an int
      s - any int, a seed to be able to produce many hashes for a given point
      Returns:
      5-bit hash of the x,y,z,w,u,v point with the given state s
    • hash32

      public static int hash32(int x, int y, int z, int w, int u, int v, int m, int s)
      A 5-bit point hash that smashes x, y, z, w, u, v, and m into s using XOR and multiplications by harmonious numbers, then runs a simple unary hash on s and returns it. GWT-optimized. Inspired by Pelle Evensen's rrxmrrxmsx_0 unary hash, though this doesn't use its code or its full algorithm. The unary hash used here has been stripped down heavily, both for speed and because unless points are selected specifically to target flaws in the hash, it doesn't need the intense resistance to bad inputs that rrxmrrxmsx_0 has.
      Parameters:
      x - x position, as an int
      y - y position, as an int
      z - z position, as an int
      w - w position, as an int
      u - u position, as an int
      v - v position, as an int
      m - m position, as an int
      s - any int, a seed to be able to produce many hashes for a given point
      Returns:
      5-bit hash of the x,y,z,w,u,v,m point with the given state s