Re: TIB: mixing up a list


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

Re: TIB: mixing up a list




>From: McBorder@aol.com
>
>Ok i have a list of 56 elements. 26 1's and 26 2's. what is the fastest way 
>i
>can mix them up, or create a list with 26 1's and 26 2's in random order
>right now i have two for loops that pick a random spot in the list and put 
>in
>a number
>ex
>
>For(a,1,26
>Lbl gn
>randint(1,52)\->\b
>if cards(b)<>0                 <> means not equal to
>goto gn
>1\->\cards(b)
>end
>For(a,1,26
>Lbl gn2
>randint(1,52)\->\b
>if cards(b)<>0                 <> means not equal to
>goto gn2
>2\->\cards(b)
>end
>
>this code slows down as the last numbers are filled so i need a faster way 
>to
>do this
>
>	thanks
>	matt c
>	http://junkworld.cjb.net

===============================================================

I suppose one way to do this would be to write:

randint(1,999,52->LST1
For(A,1,26
1->LST2(A)
End
For(A,27,52
2->LST2(A)
End
Sortx LST1,LST2

This is for the TI-86.  Hope it helps.

-Grant Winney
cosmo70@hotmail.com


_______________________________________________________________
Get Free Email and Do More On The Web. Visit http://www.msn.com