The Lewis–Goodman–Miller algorithm for generating random numbers is given by the integer relation zn+1 = 16807zn mod (231 −1). The portability problem with this method is that the rules for fixed...


The Lewis–Goodman–Miller algorithm for generating random numbers is given by the integer relation zn+1 = 16807zn mod (231 −1). The portability problem with this method is that the rules for fixed point overflow vary greatly. For a computer using two’s complement that allows an integer overflow to go unflagged, the following code was proposed:


           Z = 16807 * Z


           IF ( Z .LT. 0 ) Z = ( Z + 2147483647)+1


Check to see if your computer behaves this way by checking this algorithm, beginning with z1 = 1, and see if z10001 = 1043618065 (Park and Miller 1988).



May 03, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here