Skip to content

Commit

Permalink
Correct mix64
Browse files Browse the repository at this point in the history
  • Loading branch information
phadej committed May 14, 2018
1 parent d55cab8 commit bd0692b
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/System/Random/SplitMix.hs
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,12 @@ doubleUlp = 1.0 / fromIntegral (1 `shiftL` 53 :: Word64)
-- Note: in JDK implementations the mix64 and mix64variant13
-- (which is inlined into mixGamma) are swapped.
--
-- It's easy to verify which constants are from MurmurHash3.
-- See the link.
--
-- I have no idea if swapping them affects statistical properties.
mix64 :: Word64 -> Word64
mix64 z0 =
let z1 = shiftXorMultiply 33 0xc4ceb9fe1a85ec53 z0
z2 = shiftXorMultiply 33 0xff51afd7ed558ccd z1
-- MurmurHash3Mixer
let z1 = shiftXorMultiply 33 0xff51afd7ed558ccd z0
z2 = shiftXorMultiply 33 0xc4ceb9fe1a85ec53 z1
z3 = shiftXor 33 z2
in z3

Expand Down

0 comments on commit bd0692b

Please sign in to comment.