I don't understand the link between cryptography and RNG. All we want is an RNG that is relatively fast and easy to code (that excludes the mersenne twister right away), and that passes all known statistical tests. As far as I know the KISS RNG that I use in DoubleCheck passes all known statistical tests and is very simple. Another example is the KISS generator in Stockfish. Here's what I use in DoubleCheck, I would be glad if you could provide an example of statistical test where this generator fails, and where another one succeeds:Ron Murawski wrote: 'Best' is a slippery word. If I wanted a cryptographically secure PRNG I wouldn't use KISS, I would use something stronger. But, if I wanted to bang out good PRNs as quickly as possible, then KISS would be a good choice. Keep in mind that MersenneTwister would also be a very good choice.
Code: Select all
uint64_t rand64()
// JLKISS 64-bit RNG, by Pr. David Jones, UCL Bioinformatics Lab
{
// seed variables
static uint64_t x = 123456789123ULL, y = 987654321987ULL;
static uint32_t z1 = 43219876, c1 = 6543217, z2 = 21987643, c2 = 1732654;
x = 1490024343005336237ULL * x + 123456789;
y ^= y << 21; y ^= y >> 17; y ^= y << 30; // do not set y=0
uint64_t t;
t = 4294584393ULL * z1 + c1; c1 = t >> 32; z1 = t;
t = 4246477509ULL * z2 + c2; c2 = t >> 32; z2 = t;
return x + y + z1 + ((uint64_t)z2 << 32); // return 64-bit result
}