Nice to see you mentioned the guts of L'Ecuyer's algorithm; although it looks as if max1 in the sample code should be mod1 instead; well-written otherwise. :)
Date: 26 Jul 2009 11:54
Number of posts: 3
RSS: New posts
It's a lot easier to describe the algorithm for the TI-89 family because the language actually has the commands to describe them. Although it bothers me that rand() and RandSeed still use floating-point math when they should be done with integer math instead.
It also bothers me that there appears to be some sort of rounding trickiness going on. On my calculator, I get the following results:
:rand() .85475706751787 :(seed1-seed2)/2147483563+1 .85475706758646
Well, doing a few runs of rand on the TI-83+ and comparing with a Mathematica implementation of the algorithm shows that the TI implementation is only correct to ~8-10 digits (as in the example you gave), so it isn't confined to the 68k calculators.
Indeed, L'Ecuyer meant his method to be implemented with integer arithmetic, but well… I only wish there was somebody from TI whom we could ask.