Pick random element: Difference between revisions

Applesoft BASIC
(Pick random element in various BASIC dialents (BASIC256, True BASIC and Yabasic))
(Applesoft BASIC)
Line 306:
 
See also: [[#Liberty BASIC|Liberty BASIC]], [[#PureBasic|PureBasic]], [[#Run BASIC|Run BASIC]]
==={{header|Applesoft BASIC}}===
 
This is the same as the [[#Commodore_BASIC|Commodore BASIC]] solution, except the Commodore timer variable TI is just a regular variable in Applesoft and gets set to a 16-bit random seed value. This is a number which is continually counted up while waiting for a keypress.
<lang qbasic> 10 DIM A$(9)
20 FOR I = 0 TO 9: READ A$(I): NEXT
25 TI = PEEK(78) + PEEK(79)*256
30 X = RND ( - TI): REM 'PLANT A RANDOM SEED'
40 X = INT ( RND (1) * 10)
50 PRINT A$(X)
60 END
100 DATAALPHA, BRAVO, CHARLIE, DELTA, ECHO
110 DATAFOXTROT, GOLF, HOTEL, INDIA, JULIETT
</lang>
==={{header|Commodore BASIC}}===
<lang qbasic>10 DIM A$(9)
Line 360 ⟶ 371:
print a$(randInt)
next i</lang>
 
 
=={{header|Batch File}}==
413

edits