A86: Re: What's wrong with it?


[Prev][Next][Index][Thread]

A86: Re: What's wrong with it?




This happens because the random seed in the calculator gets screwed up. 
Several assembly language programs have bugs or just poor programming
that causes them to overwrite the random seed with bogus values that can
confuse the calculator.

Anyway, to fix it, just store a different seed in rand.  
(Just about any number will work.)
for example
0 -> rand
.5 -> rand
or even pi * e^2 -> rand
( -> is the store key)
One might think that the number should be between 0 and 1 but doesn't
seem to matter.
etc.  Incidentally, you will get the same sequence of random numbers
each time you set the seed to the same value...  If you are EXTREMELY
picky about the randomness of your numbers, use a different seed each
time you reseed rand.


> Lately, I've been trying to write a program in Calculator BASIC that
> requires the "RandInt" function.  However, the calculator gives me the
> "Error 1 Overflow" message.  The weird thing is that the numbers the
> calculator is generating should be nowhere near its bounds.  The "RandInt"
> function always seemed to work fine before, and I was wondering if anyone
> knew what caused it? (Perhaps some kind of assembly bug?)  I wrote a letter
> to TI and they suggested that I remove all the batteries and reset the
> calculator to the factory defaults.  I'm looking for a more practical
> solution.  Any comments at all are appreciated
> 
> Jeremiah.



References: