Skip to content

Instantly share code, notes, and snippets.

@ogxd
Created March 24, 2020 07:48
Show Gist options
  • Save ogxd/4868fb77c4a0c858f9514b3336d6b6ce to your computer and use it in GitHub Desktop.
Save ogxd/4868fb77c4a0c858f9514b3336d6b6ce to your computer and use it in GitHub Desktop.
public static class HashUtils
{
public static uint Lcg(uint value)
{
unchecked {
value = 1664525 * value + 1013904223;
return value;
}
}
public static uint Xorshift(uint value)
{
unchecked {
value ^= (value << 13);
value ^= (value >> 17);
value ^= (value << 5);
return value;
}
}
public static uint Wang(uint value)
{
unchecked {
value = (value ^ 61) ^ (value >> 16);
value *= 9;
value = value ^ (value >> 4);
value *= 0x27d4eb2d;
value = value ^ (value >> 15);
return value;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment