/* Based on corrpcg.c, written in 2018 by Sebastiano Vigna (vigna@acm.org) adapted for SplitMix by Melissa O'Neill (oneill@acm.org) Generates two correlated sets of outputs using SplitMix generators. See . */ #include #include #include #include #include #include inline uint64_t next(uint64_t* x) { uint64_t z = (*x += 0x9e3779b97f4a7c15); z = (z ^ (z >> 30)) * 0xbf58476d1ce4e5b9; z = (z ^ (z >> 27)) * 0x94d049bb133111eb; return z ^ (z >> 31); } int main(int argc, char* argv[]) { // Seed data fresh from /dev/random uint64_t sm1 = 0xad704951a71e258UL; // More random-looking seed data uint64_t sm2 = 0x257d71c198515697UL; for(;;) { uint64_t out = next(&sm1); fwrite(&out, sizeof out, 1, stdout); //printf("%016llx\n", out); out = next(&sm2); fwrite(&out, sizeof out, 1, stdout); //printf("%016llx\n", out); } }