Commodore VIC-20 User Manual page 114

Hide thumbs Also See for VIC-20:
Table of Contents

Advertisement

The range of possible results is now:
10< = X< -19
But wait! The upper limit of the range has dropped from 20 to
19 in this case. Why? Because before the range was always
less-than 20. The INT function will strip off any decimal places
from a number greater than "19 and less than 20 to result in a
19. On the other end of the range, any results between 10 and
eleven are truncated down to an even 10. If we still needed to
get a range of numbers from 10 to 20r the formula should
become:
X = INT(RND(1p1 +10)
The random number is multiplied to expand the range, and
added to move the range.
(
The general formula for a set of random numbers in a certain
range is:
X = INT(RND{1)*a) + b
(
Where a represents the number of possible results and b is the
lowest number in the range.
c
c
c
c
<
c
104

Advertisement

Table of Contents
loading

Table of Contents