Created
November 6, 2020 20:02
-
-
Save nikvoronin/918cfb976d9512ee046cd2d12df2ed38 to your computer and use it in GitHub Desktop.
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
__kernel void xorshift( | |
uint s1, // seed(base) 1 | |
uint s2, // seed(base) 2 | |
const int bufferSize, | |
__global float2* rngBuffer) | |
{ | |
uint st; | |
for(int i = 0; i < bufferSize; i++) { | |
st = s1 ^ (s1 << 11); | |
s1 = s2; | |
s2 = s2 ^ (s2 >> 19) ^ ( st ^ (st >> 18)); | |
rngBuffer[i] = (float2)((float)st / UINT_MAX, (float)s1 / UINT_MAX); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment