Skip to main content

HashFunction

An abstract class in Root.Township, the global namespace.

Base for a seeded hash that turns integers into repeatable pseudo-random values. XXHash is the one used for cave seeds.

Constructors​

MemberWhat it is
protected HashFunction()Creates a HashFunction with default values.

Methods​

MemberWhat it is
abstract uint GetHash(params int[] data)Hashes one or more integers to a uint.
virtual uint GetHash(int data)Hashes one or more integers to a uint.
virtual uint GetHash(int x, int y)Hashes one or more integers to a uint.
virtual uint GetHash(int x, int y, int z)Hashes one or more integers to a uint.
int Range(int min, int max, params int[] data)Hash scaled into a range: integer overloads use the remainder (max exclusive), float overloads scale linearly.
int Range(int min, int max, int data)Hash scaled into a range: integer overloads use the remainder (max exclusive), float overloads scale linearly.
int Range(int min, int max, int x, int y)Hash scaled into a range: integer overloads use the remainder (max exclusive), float overloads scale linearly.
int Range(int min, int max, int x, int y, int z)Hash scaled into a range: integer overloads use the remainder (max exclusive), float overloads scale linearly.
float Range(float min, float max, params int[] data)Hash scaled into a range: integer overloads use the remainder (max exclusive), float overloads scale linearly.
float Range(float min, float max, int data)Hash scaled into a range: integer overloads use the remainder (max exclusive), float overloads scale linearly.
float Range(float min, float max, int x, int y)Hash scaled into a range: integer overloads use the remainder (max exclusive), float overloads scale linearly.
float Range(float min, float max, int x, int y, int z)Hash scaled into a range: integer overloads use the remainder (max exclusive), float overloads scale linearly.
float Value(params int[] data)Hash scaled to a float from 0 to 1.
float Value(int data)Hash scaled to a float from 0 to 1.
float Value(int x, int y)Hash scaled to a float from 0 to 1.
float Value(int x, int y, int z)Hash scaled to a float from 0 to 1.

Used in​

Members of other types that take, return or hold a HashFunction: