Created
March 24, 2020 07:48
-
-
Save ogxd/4868fb77c4a0c858f9514b3336d6b6ce to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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