/// <summary> /// A good psuedo-random hash function for Unity's Vector2 class. /// </summary> public static int GetHashCode(Vector2 v) { //Reinterpret the floats as ints and get the hash code for them. int x = Reinterpret.Get(v.x), y = Reinterpret.Get(v.y); return(new Vector2i(x, y).GetHashCode()); }
public static int GetHashCode(float f) { //Reinterpret the floats as ints and get the hash code for them. return(Reinterpret.Get(f)); }