Skip to content
This repository has been archived by the owner on Jul 3, 2022. It is now read-only.

add SplitMix64::next_u32 from dsiutils #3

Merged
merged 1 commit into from
Jun 26, 2018
Merged

Conversation

TheIronBorn
Copy link
Contributor

dsiutils has a 32-bit method for SplitMix64 as well as 64-bit. Perhaps not very useful (and also a breaking change?) but it'd be nice have.

// 2^10 calls to each
test splitmix32 ... bench:       2,929 ns/iter (+/- 869)
test splitmix64 ... bench:       3,630 ns/iter (+/- 516)

@vks
Copy link
Owner

vks commented Jun 25, 2018

Interesting, I think this makes sense. This is technically not a breaking change, since this does not affect compilation. It breaks reproducibility, but we are still at version 0.0.1, so this is fine.

The link you provided is dead. Do you have some reference? It would be nice to add a test comparing it with the results of a reference implementation.

@vks
Copy link
Owner

vks commented Jun 25, 2018

The link to dsiutils is up again, here is the code:

	/* David Stafford's (http://zimbry.blogspot.com/2011/09/better-bit-mixing-improving-on.html)
         * "Mix4" variant of the 64-bit finalizer in Austin Appleby's MurmurHash3 algorithm. */
	private static int staffordMix4Upper32(long z) {
		z = (z ^ (z >>> 33)) * 0x62A9D9ED799705F5L;
		return (int)(((z ^ (z >>> 28)) * 0xCB24D0A5C88C35B3L) >>> 32);
	}

and

	@Override
	public int nextInt() {
		return staffordMix4Upper32(x += PHI);
	}

Do you know how much this unofficial splitmix64 variant was tested compared to the reference implementation in the paper?

@TheIronBorn
Copy link
Contributor Author

I have no idea how much it was tested.

@vks vks merged commit 51482c4 into vks:master Jun 26, 2018
@vks
Copy link
Owner

vks commented Jun 26, 2018

I see, thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants