Skip to content

Commit 4926f77

Browse files
jl_rng_split: multiplicative mixer for "splitmix" accumulator
1 parent 70b62c3 commit 4926f77

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/task.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1075,11 +1075,12 @@ void jl_rng_split(uint64_t dst[JL_RNG_SIZE], uint64_t src[JL_RNG_SIZE]) JL_NOTSA
10751075

10761076
// PCG-RXS-M-XS-64 output with four variants
10771077
for (int i = 0; i < 4; i++) {
1078+
uint64_t s = bswap_64(src[i]);
10781079
uint64_t w = x + a[i];
10791080
w ^= w >> ((w >> 59) + 5);
10801081
w *= m[i];
10811082
w ^= w >> 43;
1082-
dst[i] = src[i] + w; // SplitMix dot product
1083+
dst[i] = 2*s*w + s + w; // (2s+1)(2w+1) ÷ 2
10831084
}
10841085
}
10851086

0 commit comments

Comments
 (0)