Overflow in a random number generator and 4-byte vs. 8-byte integers
问题 The famous linear congruential random number generator also known as minimal standard use formula x(i+1)=16807*x(i) mod (2^31-1) I want to implement this using Fortran. However, as pointed out by "Numerical Recipes", directly implement the formula with default Integer type (32bit) will cause 16807*x(i) to overflow. So the book recommend Schrage’s algorithm is based on an approximate factorization of m. This method can still implemented with default integer type. However, I am wondering