(27S) Linear Congruential Random Number Generator - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: General Software Library (/forum-13.html) +--- Thread: (27S) Linear Congruential Random Number Generator (/thread-5181.html) |
(27S) Linear Congruential Random Number Generator - Gerald H - 11-22-2015 04:12 PM 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:
|