Commodore 128 System Manual page 343

Table of Contents

Advertisement

RIGHTS
Return substring from rightmost end of string
RIGHT$ (<string>, <num eric>)
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
If X > 1
If X < 0
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.
RND returns a random number based on
the hardware clock.
RND generates a reproducable psuedo-
random number based on the seed value
below.
produces a random number which is used
as a base called a seed.
18-15

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

128d

Table of Contents