Post subject: RNG Sim for TI Calculators
Joined: 10/13/2015
Posts: 9
(PDF) Nearly every TI model shares this approach to quasi-randomness; the below stays within 10-12 of their values across all seeds. The factory seed has been tested at a call depth of 100,000 with no sign of deviating. Other seeds I tried were equally well-behaved. Seeding:
Input n
a = 2147483563
b = 2147483399
c = 40014
d = 40692
If n is 0 then
  e = 12345
  f = 67890
else
  e = mod(n*c, a)
  f = mod(n, b)
Calling:
e = mod(c*e, a)
f = mod(d*f, b)
print frac((e - f)/(a - 1) + 1)
Some Mathematica-ese to play with:
seed=0;calls=1;
a=2^31-85;b=2^31-249;c=40014;d=40692;
Which[seed==0,e=12345;f=67890,seed!=0,e=Mod[seed*c,a];f=Mod[seed,b]];
Table[e=Mod[c*e,a];N[f=Mod[d*f,b];FractionalPart[(e-f)/(a-1)+1],10],{i,calls}]