EasyManua.ls Logo

Commodore CBM - Rnd

Commodore CBM
447 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...
Examples:
?LOG(1)
A=LOG(4)
A=LOG(10)
A=LOG(1
E6)
A=LOG(X)/LOG(10)
RND
Prints
O.
Results in
A=1.38629436.
Results in
A=2.30258509.
Results in
A=13.8155106.
Calculates log
to
the base
10.
RND
provides the ability
to
generate random number sequences in
PET
BASIC.
At
each reference.
RND
returns a number between 0 and
1.
0<n<1.
Format:
RND(arg)
RND(-arg)
where:
arg
-arg
Return random number.
Store new seed number.
is
a positive. non-zero number. variable, or ex-
pression. This
RND
function returns the next
random number in sequence. The value of arg
in this case
is
arbitrary;
that
is,
the random
number
returnedfor
a positive argument does
not depend on the value of the argument.
is
a negative number. variable, or expression.
The
RND
function
stores a new seed. This
causes subsequent random numbers to begin a
new sequence based on the
-arg
value.
RND
(-arg)
returns a small value. constant for the
given
-arg,
that
should
be
disregarded.
A=RND(1)
Examples:
A=RND(-1)
Store a new seed based on the
value
-1.
Fetch the next random number in
sequence.
An
argument of zero
is
treated
as
a special case in
PET
BASIC.
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 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(-RND(O))
Store random seed.
153

Table of Contents

Other manuals for Commodore CBM

Related product manuals