Created
June 2, 2020 05:28
-
-
Save hiroakioishi/fad4eadaa7fa8b8e49e76baf783d7891 to your computer and use it in GitHub Desktop.
wang_hash ランダム
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
// Wang Hash Random | |
#define WANG_HASH_SEED_MAX 4294967295 | |
#define INV_WANG_HASH_DIV 2.3283064e-10 | |
float wang_hash(uint seed) | |
{ | |
seed = (seed ^ 61) ^ (seed >> 16); | |
seed *= 9; | |
seed = seed ^ (seed >> 4); | |
seed *= 0x27d4eb2d; | |
seed = seed ^ (seed >> 15); | |
return seed * INV_WANG_HASH_DIV; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment