1
$\begingroup$

Xorshift family pseudo-random number generators have a variety of different internal state sizes.

Let's take one of this family called xorshift1024*.

My question is:

Having xorshift1024* a internal state of 1024-bits, can I generate a block shorter than 1024-bits without having to compute the entire 1024-bits output before the internal state cycles to the next?

$\endgroup$
4
  • 1
    $\begingroup$ Ummmm, have you looked at the implementation on the wiki page you linked to? That would give you the answer... $\endgroup$
    – poncho
    Commented Dec 11, 2022 at 9:39
  • $\begingroup$ @poncho Yes, but I don't know how to read C code yet. If you know how to answer, I ask to do it, just an "yes" or "not" for me is enough. $\endgroup$ Commented Dec 11, 2022 at 21:29
  • 1
    $\begingroup$ Note: There is a growing caucus that suggests no one should use C/C++ for new applications. Rust is now used in phones and the Linux kernel as a safer alternative. $\endgroup$
    – Paul Uszak
    Commented Dec 12, 2022 at 13:28
  • $\begingroup$ @PaulUszak I like Rust, but honesty, C/C++ is rather portable $\endgroup$ Commented Dec 12, 2022 at 20:08

1 Answer 1

1
$\begingroup$

Yes - you virtually always generate a shorter output block than the state. In the case of xorshift1024* you output t * 1181783497276652981 where t is a mangled and iterated variable acting over the internal state array x. That's a 64 bit value, and the return value from that function.

You'll only output state sized blocks for the simplest of this class of generators like xorshift32/64 which feature 32 and 64 bit state sizes respectively.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.