EasyManuals Logo

Atari 130XE User Manual

Atari 130XE
142 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #57 background imageLoading...
Page #57 background image
The number
in
th
e parentheses is called a
"dummy
variable
."
It does
not matter what number is us
ed
as
the
dummy
variable, but it
is
im-
portant that the parentheses appear and that they
enclose something
(any number or letter). For typing ease, 0 is usually placed
in
the
dummy variable position. Change line 10 again as shown below:
1.0
PRINT
(RND(O)
*
1.0)
RUN
1.0
PRINT
(RND(O)
*
1.00)
RUN
1.0
PRINT
(RND
(0)
*
1.000)
RUN
Each program generates a different range of random numbers. PRINT
(RN
D(O)
* 10) generates numbers up to 10 because the statement
in-
structs the computer to multiply the random number by 10. Multiplying
by 10 moves the decimal point over one place.
In
PRINT
(RND(O)
*
100), multiplying by 100 moves the decimal point over two places, and
in
PRINT
(RND(O)
* 1000), multiplying by 1000 moves the decimal
point over three places. If you want, you can multiply by much larger
numbers to generate large random numbers.
Because long numbers with many digits after the decimal point are
cumbersome, the computer has
an
instruction that tells it to print only
integers. Integers are whole numbers without any decimal points.
The
instruction I NT tells the computer to drop everything after the decimal
point. Reprogram the three variations of line 10 above and compare
the
results:
1.0
PRINT
INTCRNDCO)*1.0)
RUN
1.0
PRINT
INT
C
RND
(0)
*1.00)
RUN
1.0
PRINT
INTCRND(0)*1.000)
RUN
The programs generate numbers
in
the same ranges as before, but
the numbers are more
readable without the digits after the decimal.
To
generate numbers
in
a more specific range, try the examples
below:
1.0
PRINT
INT
CRND(0)*3)
RUN
1.0
PRINT
INT
CRNDCO)*1.2)
RUN
1.0
PRINT
INT
CRNDCO)*25)
RUN
51

Table of Contents

Other manuals for Atari 130XE

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Atari 130XE and is the answer not in the manual?

Atari 130XE Specifications

General IconGeneral
TypeHome computer
Release year1985
CPUMOS Technology 6502C
CPU Speed1.79 MHz
RAM128 KB
ROM24 KB
GraphicsANTIC and GTIA chips
ManufacturerAtari
Display resolution320x192
SoundPOKEY chip, 4 channels
StorageExternal floppy disk drive, cassette tape
Ports2 joystick ports
Operating SystemAtari BASIC

Related product manuals