Package com.io7m.jmurmur
Class Murmur3
java.lang.Object
com.io7m.jmurmur.Murmur3
An implementation of the public domain Murmur3 hash function.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The default seed if one is not explicitly given. -
Method Summary
Modifier and TypeMethodDescriptionstatic int
hashInt
(int x) Hash the given integer value using the default seed (@linkDEFAULT_SEED
).static int
hashIntWithSeed
(int x, int seed) Hash the given integer value using the given seed to randomize the results.static int
hashLong
(long x) Hash the given long value using the default seed (@linkDEFAULT_SEED
).static int
hashLongWithSeed
(long x, int seed) Hash the given long value using the given seed to randomize the results.
-
Field Details
-
DEFAULT_SEED
public static final int DEFAULT_SEEDThe default seed if one is not explicitly given. Just a large prime, no significance.- See Also:
-
-
Method Details
-
hashInt
public static int hashInt(int x) Hash the given integer value using the default seed (@linkDEFAULT_SEED
).- Parameters:
x
- The integer value.- Returns:
- A hash value.
-
hashIntWithSeed
public static int hashIntWithSeed(int x, int seed) Hash the given integer value using the given seed to randomize the results.- Parameters:
x
- The integer value.seed
- The seed value.- Returns:
- A hash value.
-
hashLong
public static int hashLong(long x) Hash the given long value using the default seed (@linkDEFAULT_SEED
).- Parameters:
x
- The long value.- Returns:
- A hash value.
-
hashLongWithSeed
public static int hashLongWithSeed(long x, int seed) Hash the given long value using the given seed to randomize the results.- Parameters:
x
- The long value.seed
- The seed value.- Returns:
- A hash value.
-