public class HastyPointHash extends IPointHash.LongImpl
PointHash
but faster. This implementation has high enough quality to be useful as a
source of random numbers based on positions, but would likely be too slow to be used in a hash table (hash tables
don't need especially high-quality hashes). At low dimensions, this is a little faster than PointHash
, but
this class doesn't slow down much at all as more dimensions are used, while PointHash and most other implementations
do slow down. You can also consider IntPointHash
if your input and output types are usually int, since it's
even faster.
IPointHash
and has a long it uses internally for state, exposed by getState()
.IPointHash.IntImpl, IPointHash.LongImpl
Modifier and Type | Field and Description |
---|---|
static HastyPointHash |
INSTANCE |
state
Constructor and Description |
---|
HastyPointHash() |
HastyPointHash(int state) |
HastyPointHash(long state) |
Modifier and Type | Method and Description |
---|---|
long |
getState() |
static int |
hash256_alt(long x,
long y,
long z,
long w,
long seed) |
static int |
hash256(long x,
long y,
long s)
Gets an 8-bit point hash of a 2D point (x and y are both longs) and a state/seed as a long.
|
static int |
hash256(long x,
long y,
long z,
long s)
Gets an 8-bit point hash of a 3D point (x, y, and z are all longs) and a state/seed as a long.
|
static int |
hash256(long x,
long y,
long z,
long w,
long s)
Gets an 8-bit point hash of a 4D point (x, y, z, and w are all longs) and a state/seed as a long.
|
static int |
hash256(long x,
long y,
long z,
long w,
long u,
long s)
Gets an 8-bit point hash of a 5D point (x, y, z, w, and u are all longs) and a state/seed as a long.
|
static int |
hash256(long x,
long y,
long z,
long w,
long u,
long v,
long s)
Gets an 8-bit point hash of a 6D point (x, y, z, w, u, and v are all longs) and a state/seed as a long.
|
static int |
hash32(long x,
long y,
long s)
Gets a 5-bit point hash of a 2D point (x and y are both longs) and a state/seed as a long.
|
static int |
hash32(long x,
long y,
long z,
long s)
Gets a 5-bit point hash of a 3D point (x, y, and z are all longs) and a state/seed as a long.
|
static int |
hash32(long x,
long y,
long z,
long w,
long s)
Gets a 5-bit point hash of a 4D point (x, y, z, and w are all longs) and a state/seed as a long.
|
static int |
hash32(long x,
long y,
long z,
long w,
long u,
long v,
long s)
Gets a 5-bit point hash of a 6D point (x, y, z, w, u, and v are all longs) and a state/seed as a long.
|
static int |
hash64(long x,
long y,
long s)
Gets a 6-bit point hash of a 2D point (x and y are both longs) and a state/seed as a long.
|
static int |
hash64(long x,
long y,
long z,
long s)
Gets a 6-bit point hash of a 3D point (x, y, and z are all longs) and a state/seed as a long.
|
static int |
hash64(long x,
long y,
long z,
long w,
long s)
Gets a 6-bit point hash of a 4D point (x, y, z, and w are all longs) and a state/seed as a long.
|
static int |
hash64(long x,
long y,
long z,
long w,
long u,
long v,
long s)
Gets a 6-bit point hash of a 6D point (x, y, z, w, u, and v are all longs) and a state/seed as a long.
|
static long |
hashAll(long x,
long y,
long s)
Gets a 64-bit point hash of a 2D point (x and y are both longs) and a state/seed as a long.
|
static long |
hashAll(long x,
long y,
long z,
long s)
Gets a 64-bit point hash of a 3D point (x, y, and z are all longs) and a state/seed as a long.
|
static long |
hashAll(long x,
long y,
long z,
long w,
long s)
Gets a 64-bit point hash of a 4D point (x, y, z, and w are all longs) and a state/seed as a long.
|
static long |
hashAll(long x,
long y,
long z,
long w,
long u,
long s)
Gets a 64-bit point hash of a 5D point (x, y, z, w, and u are all longs) and a state/seed as a long.
|
static long |
hashAll(long x,
long y,
long z,
long w,
long u,
long v,
long s)
Gets a 64-bit point hash of a 6D point (x, y, z, w, u, and v are all longs) and a state/seed as a long.
|
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) |
public static final HastyPointHash INSTANCE
public HastyPointHash()
public HastyPointHash(int state)
public HastyPointHash(long state)
public int hashWithState(int x, int y, int state)
public int hashWithState(int x, int y, int z, int state)
public int hashWithState(int x, int y, int z, int w, int state)
public int hashWithState(int x, int y, int z, int w, int u, int state)
public int hashWithState(int x, int y, int z, int w, int u, int v, int state)
public long getState()
public static long hashAll(long x, long y, long s)
x
- x position; any longy
- y position; any longs
- the state/seed; any longpublic static long hashAll(long x, long y, long z, long s)
x
- x position; any longy
- y position; any longz
- z position; any longs
- the state/seed; any longpublic static long hashAll(long x, long y, long z, long w, long s)
x
- x position; any longy
- y position; any longz
- z position; any longw
- w position; any longs
- the state; any longpublic static long hashAll(long x, long y, long z, long w, long u, long s)
x
- x position; any longy
- y position; any longz
- z position; any longw
- w position; any longu
- u position; any longs
- the state; any longpublic static long hashAll(long x, long y, long z, long w, long u, long v, long s)
x
- x position; any longy
- y position; any longz
- z position; any longw
- w position; any longu
- u position; any longv
- v position; any longs
- the state; any longpublic static int hash256(long x, long y, long s)
x
- x position; any longy
- y position; any longs
- the state/seed; any longpublic static int hash256(long x, long y, long z, long s)
x
- x position; any longy
- y position; any longz
- z position; any longs
- the state/seed; any longpublic static int hash256(long x, long y, long z, long w, long s)
x
- x position; any longy
- y position; any longz
- z position; any longw
- w position; any longs
- the state; any longpublic static int hash256(long x, long y, long z, long w, long u, long s)
x
- x position; any longy
- y position; any longz
- z position; any longw
- w position; any longu
- u position; any longs
- the state; any longpublic static int hash256(long x, long y, long z, long w, long u, long v, long s)
x
- x position; any longy
- y position; any longz
- z position; any longw
- w position; any longu
- u position; any longv
- v position; any longs
- the state; any longpublic static int hash32(long x, long y, long s)
x
- x position; any longy
- y position; any longs
- the state/seed; any longpublic static int hash32(long x, long y, long z, long s)
x
- x position; any longy
- y position; any longz
- z position; any longs
- the state/seed; any longpublic static int hash32(long x, long y, long z, long w, long s)
x
- x position; any longy
- y position; any longz
- z position; any longw
- w position; any longs
- the state; any longpublic static int hash32(long x, long y, long z, long w, long u, long v, long s)
x
- x position; any longy
- y position; any longz
- z position; any longw
- w position; any longu
- u position; any longv
- v position; any longs
- the state; any longpublic static int hash64(long x, long y, long s)
x
- x position; any longy
- y position; any longs
- the state/seed; any longpublic static int hash64(long x, long y, long z, long s)
x
- x position; any longy
- y position; any longz
- z position; any longs
- the state/seed; any longpublic static int hash64(long x, long y, long z, long w, long s)
x
- x position; any longy
- y position; any longz
- z position; any longw
- w position; any longs
- the state; any longpublic static int hash64(long x, long y, long z, long w, long u, long v, long s)
x
- x position; any longy
- y position; any longz
- z position; any longw
- w position; any longu
- u position; any longv
- v position; any longs
- the state; any longpublic static int hash256_alt(long x, long y, long z, long w, long seed)
Copyright © Eben Howard 2012–2022. All rights reserved.