Last active
January 8, 2021 12:55
-
-
Save fboldog/a76648e1580b88ca9957f60b20edf49c to your computer and use it in GitHub Desktop.
wang hash -> shader hashing fuction (http://www.reedbeta.com/blog/quick-and-easy-gpu-random-numbers-in-d3d11/)
This file contains 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
uint wang_hash(uint seed) | |
{ | |
seed = (seed ^ 61) ^ (seed >> 16); | |
seed *= 9; | |
seed = seed ^ (seed >> 4); | |
seed *= 0x27d4eb2d; | |
seed = seed ^ (seed >> 15); | |
return seed; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
what seed do you usually use with this?