Skip to content

Commit

Permalink
jl_rng_split: multiplicative mixer for "splitmix" accumulator
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanKarpinski committed Feb 21, 2024
1 parent 70b62c3 commit 4926f77
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/task.c
Original file line number Diff line number Diff line change
Expand Up @@ -1075,11 +1075,12 @@ void jl_rng_split(uint64_t dst[JL_RNG_SIZE], uint64_t src[JL_RNG_SIZE]) JL_NOTSA

// PCG-RXS-M-XS-64 output with four variants
for (int i = 0; i < 4; i++) {
uint64_t s = bswap_64(src[i]);
uint64_t w = x + a[i];
w ^= w >> ((w >> 59) + 5);
w *= m[i];
w ^= w >> 43;
dst[i] = src[i] + w; // SplitMix dot product
dst[i] = 2*s*w + s + w; // (2s+1)(2w+1) ÷ 2
}
}

Expand Down

0 comments on commit 4926f77

Please sign in to comment.