TIB: Random Number Generation Different From The One Before


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

TIB: Random Number Generation Different From The One Before





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

Here is the fastest way i can think of the progam takes ~1 min to find all the
values

 ** ü=store to  **

:{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27}üNUM
S   (the numbers you want)
:27üMA
							  (how many )
:Lbl GETN
:randInt(1,MA)üN           	   (picks a number to take out of the list)
:If NUMS(N)==0           		   (checks to make sure we didnt pick it before)
:Goto GETN                  	   (if yes to above get another)
:NUMS(N)üNUMBER 		   (saves value as NUMBER)
:0üNUMS(N)				   (put 0 into list meaning that it has already been used)
:Disp NUMBER	                      (disps it)

(your code goes here)
...
...
...

:Goto GETN        ( get new number)

just add your code into the body of the loop  :)

	--Matt