TIB: Re: Random Number Generation Different From The One Before


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

TIB: Re: Random Number Generation Different From The One Before




Here's what I used, it took me about 15 seconds to find all 24
values(I used it originally for 13). I put all the values into a list,
chose one, took it out of the list, chose another one took it out of
the list... until none were left.

:seq(x,x,1,24)->LIST    ***Populate the list
:seq(0x,x,1,24)->CHK    ***Not necessary
:
:While dimL LIST
:iPart (dimL LIST*rand+1)->x    ***Find a random index number in the
                                                ***list
:Disp LIST(x)                            ***Display the item, not
necessary
:LIST(x)->CHK(dimL LIST)       ***Add it to the check list, not
necessary
:
:For(x,x,dimL LIST-1)
:LIST(x+1)->LIST(x)            ***Shift all the items after the
                                            ***selected one down one
position
:End
:
:dimL LIST-1->dimL LIST    ***Resize the list
:End

This will produce a list named CHK that contains all the values
randomized. Try it, it took around 15 seconds to run.

Philipp Keller



>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
>