EasyManuals Logo

Tandy 1000 Basic Reference Manual

Default Icon
411 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #287 background imageLoading...
Page #287 background image
Chapter
10
I
BASIC
Ke.ywords
RANDOMIZE
RANDOMIZE
[number]
Function
Reseeds the random number generator.
Number
may be an integer, or single- or double precision num-
ber.
If
you omit
number,
BASIC suspends program execution and
prompts you for
a
number before executing RANDOMIZE:
Random Number Seed (-32768 to
32767)7
If
the random number generator is not reseeded, the RND func-
tion returns the same sequence of numbers each time it is exe-
cuted. To change the sequence of random numbers every time
the RND function
is
executed, place
a
RANDOMIZE statement
before the RND function.
You can use the TIMER function to ensure that the random
number generator
is
reseeded with
a
different value each time
BASIC executes the RANDOMIZE function. For example, the
statement:
RANDOMIZE TIMER
uses the value returned by TIMER as the seed. TIMER returns
the number
of
seconds that have elapsed since midnight or the
last system reset. Because the seconds are constantly changing,
number
has
a
different value each time BASIC executes this
st at ement
.
Sample Program
10
CLS
20 RANDOMIZE
TIMER
30 INPUT
"PICK
A
NUMBER BETWEEN
1
AND
100";
A
40
B
=
INT<RND*100)
50
IF
A=B
THEN
80
60
PRINT
"You
lose,
the answer is"B;"--try
a ga
i
n
.
"
70 GOT0 20
80
PRINT
"You picked the right number
--
you
win."
285

Table of Contents

Other manuals for Tandy 1000

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Tandy 1000 and is the answer not in the manual?

Tandy 1000 Specifications

General IconGeneral
ProcessorIntel 8088
Processor Speed4.77 MHz
RAM128 KB (expandable to 640 KB)
Operating SystemMS-DOS 2.11
ManufacturerTandy Corporation
Release Year1984
StorageSingle or double 5.25" floppy disk drive (360 KB), optional hard drive
SoundTandy 3-voice sound
PortsParallel, Serial
GraphicsCGA (Color Graphics Adapter)
Graphics Modes320x200, 640x200

Related product manuals