EasyManua.ls Logo

Commodore VIC-20 - Page 392

Commodore VIC-20
404 pages
Print Icon
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...
378
The
VIC
20
User
Guide
MMS.RIGHT$()($+
"4t
" ,5)
MM$
is
assigned the last four characters of X$,
plus the character
#
RND
RND
generates random number sequences ranging between 0 and
1.
Format:
RND(arg
n)
Return random number
RND(-arg
n)
Store new seed number
Example:
A"RND(-1)
Store a new seed based
on
the value
-I
A"RND(
1)
Fetch the next random number in sequence
An argument
of
zero
is
treated as a special case; it does
not
store a new
seed,
nor
does it return a random number. RND(O) uses the current system
time value TI to introduce
an
additional random element into play.
A pseudo-random seed
is
stored by the following function:
RND(-TI) Store pseudo-random seed
RND(O) can be used to store a new seed
that
is
more truly
random
by
using the following function:
RND(-RNDC0»
Store random seed
For
a complete discussion
of
the
RND
function see Chapter
5.
SGN
SGN determines whether a number
is
positive, negative,
or
zero.
Format:
SGN(argn)
The SGN function returns + 1 if the number
is
positive
or
nonzero, 0 if
the number
is
zero,
or
-1
if the number
is
negative.
Example:
?SGN(-6)
?SI3N(0)
?SON(44)
Displays
-I
Displays 0
Displays 1

Other manuals for Commodore VIC-20

Related product manuals