Daniel Lemire's blog

, 4 min read

The Xorshift1024* random number generator fails BigCrush

5 thoughts on “The Xorshift1024* random number generator fails BigCrush”

  1. Arjen says:

    Looks like you should edit the Wikipedia page 😉

    1. Editing the Wikipedia pages requires mere seconds, I would rather that independent parties look at the evidence I provide and do the work. Maybe you’d like to volunteer to edit the couple of pages in question?

  2. Gé Weijers says:

    It should come as no surprise that the low order bit(s) of these generators are LFSR sequences. Multiplying the output by any odd number preserves the low order bit.
    It’s not all that hard to come up with an RNG that passes TestU01.
    Replacing the ‘next’ function from the xorshift128+ generator with a variant seems to do the trick:

    uint64_t next(void) {
    uint64_t s1 = s[0];
    const uint64_t s0 = s[1];
    //const uint64_t result = s0 + s1;
    const uint64_t result = rotl64(s0, s1 & 0x3f);
    s[0] = s0;
    s1 ^= s1 <> 18) ^ (s0 >> 5); // b, c
    return result;
    }

    I have no idea whether that’s a high quality RNG, but the performance should be good on most modern processors that use a barrel shifter to implement rotate instructions. I ‘designed’ it to pass a test suite. Is an RNG that passes TestU01 necessarily ‘better’ than one that doesn’t?

    1. Is an RNG that passes TestU01 necessarily ‘better’ than one that doesn’t?

      I make no such claim myself, though if one is going to argue for statistical quality, one should have some kind of testable argument.

  3. logos01 says:

    “The goal standard” should be “The gold standard”