8-Bit Software Online Conversion

FTBL Random numbers - Listing

10 REM Demo of Ftblpls algorithm.(Ext racted from Iss26 by Roy Dickens) 20 REM Magenta shows random nos. as g enerated with the associated 'dr' value 30 REM White nos. show dr being decre mented as duplicated random nos. occur 40 REM Cyan shows final selection for comparison. 50 REM use fkeys 8 and 9 to LIST & RU N 60 REM Demo by 3PM 14Apr93 DP-J 70 : 80 *KEY8MO.3|MV.14|ML.|M 90 *KEY9RUN|M 100 MODE7 200 selections=15 300 DIM B%(selections) 400 : 1990 FORdr=1TOselections 1995 c=c+1 :REM c=loop count 2000 B%(dr)=RND(58) :Rc=Rc+1: REM Rc= Random no count. 2005 PRINTTAB(0)CHR$(133)B%(dr)" ";dr ; :PRINTCHR$(135); 2010 l=0 :REM ref only, not used 2020 FORen=0TOdr-1 2030 IFB%(en)=B%(dr)THENdr=dr-1:l=1:PRI NT;dr" "; :REM l=1 ref only, not used 2035 c=c+1 2040 NEXTen 2050 REM this line omitted from origina l prog. for display reasons. It produced the same result as line 2085 below, but as the results were being generated rat her than reading B%() at the end, as her e. 2060 NEXTdr 2075 PRINTTAB(21,21)CHR$(134)"selecti ons = ";selections;TAB(21,22)CHR$(133)"R nd no. count = ";Rc;TAB(21,23)CHR$(130)" loop count = ";c; 2085 FORi=1TOselections:PRINTTAB(20,i -1)CHR$(134)B%(i)" ";:NEXT 2095 PRINTTAB(21,24)CHR$(129)"<Algori thm Test>";:VDU30;:PRINTTAB(0,0)CHR$(133 )"RND(58)"TAB(13,0)" dr";TAB(31,0)CHR$(1 34)"B%()";TAB(0,1);CHR$(133);