This is basically a repost of my thread from gamedev.ru ( http://www.gamedev.ru/code/forum/?id=215866 ).
If we want a PRNG, than thanks to http://www.pcg-random.org we now have a pretty decent one, at least as far, as gamedev goes.
Sometimes, we want a pure function, however. It can be thought of as a stateless random number generator.
And here situation is somewhat worse. Google search would lead most people to the one from libnoise: http://libnoise.sourceforge.net/noisegen/index.html#coherentnoise . Which is quite frankly, not all that good.
Typical advice is to use some hash function. But without specifying which one, it is not all that helpful. Some are not very good and to find and test a good one takes effort.
So this thread is intended to find a quality one, in hopes that it may be helpful to a lot of people.
More precisely. Problem statement: devise a function with signature
uint32_t noise_uint32(uint32_t n);
that behaves as a discrete white noise. Output is uniformly distributed over range of uint32_t.
Current best shot:
uint32_t noise_uint32(uint32_t n)
{
uint64_t state=n;
state=state*state;
state=state*6364136223846793005ULL+1442695040888963407ULL;
uint32_t xorshifted=uint32_t(((state>>18u)^state)>>27u);
uint32_t rot=uint32_t(state>>59u);
return (xorshifted>>rot)|(xorshifted<<((-rot)&31));
}
This actually passes SmallCrush from but not Crush. NOTE: TestU01 is for stateful rng's, so it was fed with sequental outputs ( noise_uint32(0), noise_uint32(1), noise_uint32(2), ...).
The line
state=state*state;
makes difference between passing and failing SmallCrush.
One question is of legal issues: this function is clearly derived from PCG (which is under Apache license). Can I place it into the public domain (which is what I want)?
And the main point of the thread: searching for volunteers to invent functions and test them by TestU01. This may require a lot of machine time.
And post findings, naturally, in this thread.