xosplitshimixro512 — but at what cost?

22 views
Skip to first unread message

Jsknkj RNG

unread,
Feb 27, 2023, 3:19:58 PM2/27/23
to prng
static inline uint64_t rotl(const uint64_t x, int k) {return (x<<k)|(x>>(64-k));}

static uint64_t s[8];

uint64_t next(void){
uint64_t z = s[1];
const uint64_t t = z<<11;
z = (z ^ (z >> 30)) * 0xbf58476d1ce4e5b9;
z = (z ^ (z >> 27)) * 0x94d049bb133111eb;
s[2] ^= s[0];
s[5] ^= s[1];
s[1] ^= s[2];
s[7] ^= s[3];
s[3] ^= s[4];
s[4] ^= s[5];
s[0] ^= s[6];
s[6] ^= s[7];
s[6] ^= t;
s[7] = rotl(s[7],21);
return z ^ (z >> 31);
}

Period of 2^512-1, eight k-equidistributed, non-linear and seems very strong overall — however, the fatal flaw is that since seeding must be radically different than the RNG itself, SplitMix64 can no longer be used to seed. This makes xoshiro512** and xoshiro512++ the better option.
Reply all
Reply to author
Forward
0 new messages