dimanche 17 janvier 2021

How do I utilise this xoshiro128++ PRNG?

The source code for xoshiro128++ is here: http://prng.di.unimi.it/xoshiro128plusplus.c

From what I can see, the "state" of the PRNG is stored inside the "static uint32_t s[4];". The random number itself, when generated, it stored inside the result constant. Now my questions are as follows:

  1. Why is result calculated at start of next() and not the end of it? Doesn't make.
  2. Why did author write rotl function, certainly a method must already exist in C/C++ to do this write?
  3. How does one provide a "seed" value to this PRNG exactly? There is no function provided to do such a basic thing here.

Now the description of the jump function does not make things completely clear.

  1. What is the purpose of JUMP constant? it is declared as static constant.
  2. Why does jump() function need local variables called s0, s1, s2 & s3 inside it which are xored with the values inside the global value s[4]? These are not declared as static variable sinside the function.
  3. Why do we need 3 loops (2 of them nested), and not just call next() using a single loop 2^64 times?
  4. Why does UINT32_C << b exactly do?
  5. The description says that "it can be used to generate 2^64 non-overlapping subsequences for parallel computations" but a single call to function calls next() 2^64 times and throws away the result everytime by calling next() again. How exactly is it helping us generate 2^64 values for "parallel computation" (whatever that means)?



Aucun commentaire:

Enregistrer un commentaire