TIB: Re: TI-Basic Digest V1 #450


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

TIB: Re: TI-Basic Digest V1 #450




there's a simple command available in ti-basic called 'and'.  it's a bit
manipualator used to mask out bits.  i frequently use it in assembly but have
never used it in ti-basic.  here's how you would use it to generate a random
number between 1 and 24:
:rand->A
:A and 24->A
i've never tested this.  another way that i'm sure will work but is a lot
bigger:
:Lbl RandomNumber
:rand->A
:int 10A->A
:If A>24
:Goto RandomNumber
once this is finished, it will continue with the next line of code if the
random number in integer form into A.  it checks the number to make sure that
it's less than 24, and if it isn't less than 24, it will execute the loop
again.

jimi malcolm
<< On the 86, how do I get a random integer between 1 and 24, and then if the
 number has already been used, it can't be used again?  Is there any shorter
 way than testing all the numbers prior to it for the chosen number?  Please
 don't waste mine and your time by telling me you don't have an 86.  Thanks in
 advance.
 
 Glen >>