RANDOM
I RANDOM
Function I
Reseeds the random number generator.
If your program uses the RND function, every time you load
it,
BASIC
generates the same sequence of pseudorandom numbers. Therefore,
you may want to put RANDOM at the beginning of the program. This
will help ensure that you get a different sequence of pseudorandom
numbers each time you
run
the program.
RANDOM needs to execute just once.
Sample Program
600
CLS
:
RANDOM
610
INPUT
"PICK A
NUMBER
BETWEEN
1
AND
5";
A
620
B = RND(5)
630
IF A = B
THEN
650
640
PRINT
"YOU
LOSE,
THE
ANSWER
IS"
B "--TRY
AGAIN."
645
GOTO
610
650
PRINT
"YOU
PICKED
THE
RIGHT
NUMBER
--
YOU
WIN!":
GOTO
610
2-148