Thread: Random numbers
View Single Post
Old 16 November 2020, 10:49   #10
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 990
Quote:
Originally Posted by meynaf View Post
There is another way to work around this shortcoming : just rotate the result.
This will not, however, fix the problem with the short period of the algorithm (for a 32-bit seed, it's in the thousands).
No. The period of a linear congruence random generator does not depend on the seed. It depends on the gcd of the modulo and the multiplier, here 2^32 and, well, the magic number in the code. This number here was not picked at random, so the period is really maximal. It is not in the thousands. Note, however, that this assumes that you pick bits from the MSB on. The period on the LSBs is small.
Thomas Richter is offline  
 
Page generated in 0.06504 seconds with 11 queries