Sharp OZ-707 Operation Manual - Page 107

Data. Restore

Page 107 highlights

RANDOMIZE P D FORMAT: RANDOMIZE Abbreviation: RA. See Also: RND PURPOSE: Resets the seed for random number generation. REMARKS: When random numbers are generated using the RND function, the Card begins with a predetermined "seed" or starting number. RANDOMIZE resets this seed to a new randomly determined value. The starting seed will be the same each time the power 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 RANDOMIZE statement can be used to make the seed itself random. READ p FORMAT: READ variable. variable, .... variable Abbreviation: REA. See Also: DATA. RESTORE PURPOSE: Reads values from a DATA statement and assigns them to variables. REMARKS: When assigning initial values to an array, it is convenient to list the values in a DATA statement and use a READ statement in a FOR...NEXT loop to load the values into the array. When the first READ is executed, the first value in the first DATA statement is returned. Succeeding READs use succeeding values in the order in which they appear in the program. regardless of how many values are listed in each DATA statement or how many DATA statements are used. If desired. the values in a DATA statement can be read a second time using the RESTORE statement. Note: The type of data must match the type of variables (numerical or string) to which it is to be assigned. 202 203

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128

RANDOMIZE
FORMAT:
RANDOMIZE
Abbreviation:
RA.
See
Also:
RND
PURPOSE:
Resets the seed for random number generation.
REMARKS:
When random numbers are generated using the RND function, the
Card begins with a predetermined "seed" or starting number.
RANDOMIZE resets this seed to a new randomly determined value.
The starting seed will be the same each time the power 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 RANDOMIZE statement can be used to make the seed
itself random.
202
P
D
READ
FORMAT:
READ variable. variable,
....
variable
Abbreviation:
REA.
See
Also:
DATA. RESTORE
PURPOSE:
Reads values from a DATA statement and assigns them to variables.
REMARKS:
When assigning initial values to
an
array, it is convenient to list the
values
in
a DATA statement and use a READ statement in a
FOR ... NEXT loop to load the values into the array. When the first
READ
is
executed, the first value in the first DATA statement
is
returned. Succeeding READs use succeeding values
in
the order
in
which they appear
in
the program. regardless of how many values are
listed
in
each DATA statement or how many DATA statements are
used.
If desired. the values
in
a DATA statement can
be
read a second time
using the RESTORE statement.
Note:
The type of data must match the type of variables (numerical or string)
to which it
is
to be assigned.
203
p