EasyManua.ls Logo

Radio Shack TRS-80 Model 4 - Page 281

Radio Shack TRS-80 Model 4
418 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
Loading...
RND
Sample Program
850
RESTORE :
ON
ERROR
GOTO
880
860
READ COMPANY$
870
PRINT
RIGHT$(COMPANY$,
2),
GO
TO
860
880
END
880
DATA
"BECHt1AN LUMBER
COMPANY,
SEATTLE
tWA"
800
DATA
"ED
NORTON
SEWER
SERl,JICE t BROOKLYN t
NY"
810
DATA "HAMMON
MANUFACTURING
COMPANY,
HAMMOND
tIN"
This program prints the name of the state
in
which each company
is
located.
IRND(number)
Function I
Generates a pseudorandom number between 0
and
number.
Number
must
be
greater than or equal
to
0
and
less than 32768.
RND produces a pseudorandom number using the current "seed"
number. BASIC generates the seed internally, therefore, it
is
not
accessible to the user.
RND
may
be
used
to
produce random
numbers between
0
and
1,
or random integers greater than
0,
depending
on
the argument.
RND(0) returns a single-precision value between
0
and
1,
RND(number) returns
an
integer between 1 and number. For
example, RND(55) returns a pseudorandom integer between 1 and
55.
RND(55.5) returns a pseudorandom number between 1 and 56
(the argument
is
rounded).
Examples
A =
RND(2)
assigns A a value of 1 or
2.
A =
RND
(L15)
assigns A a random integer between 1
and
45.
PRINT
RND
(0)
prints a decimal fraction between 0 and
1.
2-155

Other manuals for Radio Shack TRS-80 Model 4

Related product manuals