|
|
|
int rand_gen(in int n) {
|
|
n = (n << 13) ^ n;
|
|
return (n * (n*n*15731+789221) + 1376312589) & 0x7fffffff;
|
|
}
|
|
|
|
float rand_float(inout int n) {
|
|
n = rand_gen(n);
|
|
return float(n) / float(0x7fffffff);
|
|
}
|
|
|
|
void rand_mix(inout int n, int v) {
|
|
n = rand_gen(n ^ v);
|
|
}
|
|
|