3 ms·
I'm looking for code that will execute the same on all CPU/GPUs, I found this one so far: float rand_from_seed(inout uint seed) { int k; int s = int(
by bullen 5y ago
I'm looking for code that will execute the same on all CPU/GPUs, I found this one so far:
float rand_from_seed(inout uint seed) {
int k;
int s = int(seed);
if (s == 0)
s = 305420679;
k = s / 127773;
s = 16807 \* (s - k \* 127773) - 2836 \* k;
if (s < 0)
s += 2147483647;
seed = uint(s);
return float(seed % uint(65536)) / 65535.0;
}
Any one know if the methods in this article will work too?