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

4.6 Random Numbers:

Applesoft's 'RND(x)' function returns a pseudo-random number based on
the value of x. If x=0, the last-returned random number is returned,
If x>0, then the result is in the range 0<=RND(x)<1. If x<0, the
random number generator is seeded based on x; subsequent calls with
x>0 will return the same sequence.

The random number generator is fairly predictable; you may want to
investigate other methods for heavy-duty number generation.

If you want a integral random number between 1 and N, you should use
an expression like 'VALUE%=INT(RND(1)*N)+1'

_________________________________________________________________

Section 5: Disk I/O

5.1: General intro and simple commands

This is only available once you've started up your computer with DOS
3.3 or ProDOS. [If you haven't, then reboot into one of those before
typing in your program. With some trickery, you can boot a DOS 3.3
"slave" disk and recover a BASIC program you've already typed in, but
this is too technical for here.] For the most part, DOS 3.3 and ProDOS
can act almost identically to a running program until you try and use
the features available only in one of them. For more information on
DOS 3.3 and ProDOS commands, see their FAQ at
http://www.visi.com/~nathan/a2/faq/dos.html.

Also, the restrictions on filenames differs significantly between the
two. DOS 3.3 must start with a letter, but the rest of the 30
characters can be pretty much anything, and the file are case
sensitive. [Certain other characters are very difficult to type from
the command line, such as the comma, return and other control
characters like control-H] ProDOS must start with a letter, but the
remaining 14 characters (15 total) can only be letters, 0-9 and '.'.
ProDOS filenames are stored as uppercase only, so it's case
insensitive.

Note that all DOS commands are done as an addon to Basic, so their
commands can not be inserted in the middle of your program code. You
must 'PRINT' all your commands, preceeded by a control-D character.
The most common way of doing this is to assign the control-D to a
string variable, usually D$. Then, use D$ before all disk commands.
For example, 'D$=CHR$(4): PRINT D$"CATALOG"' You can also use a 'PRINT
CHR$(4)"CATALOG"' to achieve the same effect. This FAQ uses the second
method to be clearer.

In addition, DOS 3.3 wants the control-D to be the first character in
an output line; if you are having troubles, prepend a blank 'PRINT'
before the command, e.g. 'PRINT : PRINT CHR$(4)"CATALOG"'. ProDOS
wants the control-D to be the first character PRINTed.

DOS 3.3 does have a few bugs related to the GET command. If the first
character printed after a GET is a control character, it will get
eaten. This prevents all DOS commands from working, unless you print a
sacrifice control character after GETs. Control-A (CHR$(1)) doesn't
acffect the screen or anything else, which makes it nice and useful.