dimanche 16 août 2020

Calculating the nth number of xorshift

I know that XorShift32 is the random function that returns a value between 1 and 2^32-1.

uint32_t xorshift32(uint32_t x)
{
    x ^= x << 13;
    x ^= x >> 17;
    x ^= x << 5;
    return x;
}

Since numbers are repeated, I want to know how to find the when the specific number appears starting from a specific number (for example, starting from 1, 307599695 is the 5th number).

Is there any method without using for loop?




Aucun commentaire:

Enregistrer un commentaire