blob: 51f9c80758f45a214a1c33198aed5920bf0af015 (
plain)
1
2
3
4
5
6
7
8
9
10
11
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;
}
|