EasyManua.ls Logo

Commodore 128 - Page 343

Commodore 128
448 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...
RIGHTS
Return substring from rightmost end of string
RIGHT$ (<string>, <numeric>)
This function returns a substring taken from the rightmost
characters of the string argument. The length of the substring is
defined by the length argument which can be any integer in the
range of 0 to 255. If the value of the numeric expression is zero,
then a null string is returned. If the value given in the length
argument is greater than the length of the string, the entire string
is returned. Also see the LEFT$ and MID$ functions.
EXAMPLE:
PRINT RIGHT$(BASEBALL,5)
EBALL
RND
Return a random number
RND (X)
This function returns a random number x, such that 0 < = x < 1.
This is useful in games, to simulate dice roll and other elements
of chance. It is also used in some statistical applications.
If X = 0 RND returns a random number based on
the hardware clock.
If X > 1 RND generates a reproducable psuedo-
random number based on the seed value
below.
If X < 0 produces a random number which is used
as a base called a seed.
To simulate the rolling of a die, use the formula INT(RND(1) * 6 +
1). First the random number is multiplied by 6, which expands the
range to 0-6 (actually, less than six). Then 1 is added, making the
range from 1 to less than 7. The INT function truncates all the
decimal places, leaving the result as a digit from 1 to 6.
18-15

Table of Contents

Other manuals for Commodore 128

Related product manuals