Re: TI-85 Programming Question


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

Re: TI-85 Programming Question



excel98@norfolk.infi.net wrote:


>Can anyone explain to me how to use the rand function.


rand generates a random number betweeen 0 and 1 e.g. 0.2386234 or
whatever.  If typing rand on its own from the home screen is giving
you an errror then it may need a seed - try typing "0->rand" (where ->
is the sto button).


> I simply want it to
>randomly output a number from one to ten.


I which case type:


        iPart (rand*10) +1


basically take your number, multiply it by 10 and take only the whole
number part.  On its own this would give you either 0,1,2,3,4,5,6,7,8
or 9 - but as you wanted 1 to 10 (not 0 to 9) simply add 1.


>Or randomly output a variable.


Simply take the line above and store it (->) into a variable.


I hope this helps, if you have any questions just ask.


Matthew Shaylor


References: