It is famous that lower bits of the function rand() is not random.
So, it is not good to generate random numbers within a range by using rand() and modulo as follows:
rand() % M
, where a number in [0, M-1] is generated.
Now, I wonder how about xorshift.
xorshift() % M
That is, if replacing rand() by xorshift() as above, is a generated number a good random number?
Aucun commentaire:
Enregistrer un commentaire