(27S) Linear Congruential Random Number Generator

11222015, 04:12 PM
(This post was last modified: 06152017 01:23 PM by Gene.)
Post: #1




(27S) Linear Congruential Random Number Generator
The next pseudorandom number R# given by the formula
R# := ( R# * A# + C# ) MOD R#MOD is produced by the equation below, to be stored in the Solve application on the HP 27S calculator. Store the modulus, eg 999,999,999,989 in R#MOD, multiplier, eg 979,767,979,797 in A#, additive constant, eg 1 in C# and a seed, eg 1666 in R#. Actuating R# will produce the next pseudorandom integer, in our case 293,454,359,755. The variable FRCT seen in the variable menu is only to be recalled, not actuated, & shows the value of R# / R#MOD. Results are correct for R#MOD < 10^12. Code:


« Next Oldest  Next Newest »

User(s) browsing this thread: 1 Guest(s)