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.
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:
R#=0*AR#*CR#+L(R,MOD(MOD(MOD(MOD(MOD(L(X,G(R#)-L(I,MOD(G(R#),1000000)))*L(H,G(AR#)-L(J,MOD(G(AR#),1000000))),R#MOD)+MOD(G(X)*G(J),-R#MOD),R#MOD)+MOD(G(H)*G(I),-R#MOD),-R#MOD)+G(I)*G(J),-R#MOD)+CR#,R#MOD))+0*L(FRCT,G(R)/R#MOD)*FRCT