Radio Shack TRS-80 PC-3 Owner's Manual page 161

Table of Contents

Advertisement

1 RANDOM
Abbreviations: RA., RAN., RAND., RANDO.
Purpose
The RANDOM verb is used to reset the seed for random number generation.
Use
When random numbers are generated, using the RND function, the
PC-3
Computer begins with a predetermined "seed" or starting
number. The RANDOM verb resets this seed to a new randomly-determined value.
The starting seed will be the same each time the
PC-3
Computer is turned on, so the sequence of random numbers generated with
RND is the same each time, unless the seed is changed. This is very convenient during the development of a program, because it
means that the behavior of the program should be the same each time it is run, even though it includes a RND function. When you
want the numbers, to be truly random, the RANDOM statement can be used to make the seed itself random.
Examples
10
RANDOM
20
X
=
RND 1
When run from line 20, the value of X is based on the standard seed. When run from line 10, a new seed is
used.
161

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents