diff options
author | jaseg <git@jaseg.de> | 2023-10-02 01:23:31 +0200 |
---|---|---|
committer | jaseg <git@jaseg.de> | 2023-10-02 01:23:31 +0200 |
commit | c8623eb4c6c1464ffd49e83126e66d71ba5bf862 (patch) | |
tree | 55151e10f1ca05f2539de59778e757819038678e /common/xorshift.c | |
parent | 67e30fa91e12b452c1a18f6c5eb8a33cdb9ec625 (diff) | |
download | 8seg-c8623eb4c6c1464ffd49e83126e66d71ba5bf862.tar.gz 8seg-c8623eb4c6c1464ffd49e83126e66d71ba5bf862.tar.bz2 8seg-c8623eb4c6c1464ffd49e83126e66d71ba5bf862.zip |
8b10b issues
Diffstat (limited to 'common/xorshift.c')
-rw-r--r-- | common/xorshift.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/common/xorshift.c b/common/xorshift.c new file mode 100644 index 0000000..51f9c80 --- /dev/null +++ b/common/xorshift.c @@ -0,0 +1,12 @@ + +#include "xorshift.h" + +uint32_t xorshift32(uint32_t x) +{ + /* Algorithm "xor" from p. 4 of Marsaglia, "Xorshift RNGs" */ + x ^= x << 13; + x ^= x >> 17; + x ^= x << 5; + return x; +} + |