EasyManua.ls Logo

Radio Shack TRS-80 Model 3 - Page 192

Radio Shack TRS-80 Model 3
276 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...
71)0
LINE
:1.0
JUST
ONCE
TRS-80 MODEL
III
RANDOM
RANDOM
is actually a complete statement ratherthan a function.
It
reseeds the
random number generator.
If
a program uses
the
RND
function, you may want to put
RANDOM
at the beginning
of
the program. This will ensure that you get an
unpredictable sequence
of
pseudo-randomnumbers each time you turn on the
Computer, load the program, and run it.
:I.
~~I
r~/:iN1)OI'l1
2(l.1 p
F~
I N'r
F~I\ID
(
'(,1
)
'S
~"5
(ll
GO
'I"
0
:;;:~
(ZI
RND(x)
Generates a pseudo-random numberusing the currentpseudo-random" seed
number" (generated internally and not accessible to user).
RND
may be used to
produce random numbers between 0 and 1,
or
randomintegers greater than 0,
depending on the argument.
RND(O)
returns a single-precision value between 0 and
1.
RND(integer) returns an
integerbetween 1 and
integer
inclusive (integer must be positive and less than
32768).
For
example, RND(55) returns a pseudo-random integergreaterthan zero
and less than 56.
RND(55
.5) returns a numberin the same range, because
RND
uses
the INTeger value
of
the argument.
100 X = RND(2) :ON X
GOTO
200,300
SGN(x)
The
"sign"
function: returns - 1 for X negative, 0 for X zero, and + 1for X
positive.
100 ON SGN(X) +2
GOTO
200,300,400
7/4

Related product manuals