I was going through a book that explained the xorshift algorithm (I know, basic stuff). Then, while searching a little bit more on the Internet, I found that all the basic examples seem to shift the bits right the same "amount" (13, 17, 5).
For instance:
struct xorshift32_state {
uint32_t a;
};
uint32_t xorshiftTransform(struct xorshift32_state *state) {
uint32_t x = state->a;
x ^= x << 13;
x ^= x >> 17;
x ^= x << 5;
return state->a = x;
}
Is there a particular reason why in all examples they use 13
, 17
and 5
? Yep, I found other examples too, but this one keeps repeating, and I don't know if the numbers choose is trivial or not.
Aucun commentaire:
Enregistrer un commentaire