![Campbell CR9000 Instruction Manual Download Page 178](http://html1.mh-extra.com/html/campbell/cr9000/cr9000_instruction-manual_489197178.webp)
Section 8. Processing and Math Instructions
8-18
Randomize
Initializes the random-number generator.
Syntax
Randomize
[
number
]
Remarks
The argument
number
can be any valid numeric expression.
Number
is used to
initialize the random-number generator by giving it a new seed value. If you omit
number
, the value returned by the Timer function is used as the new seed value.
If
Randomize
is not used, the Rnd function returns the same sequence of random
numbers every time the program is run. To have the sequence of random numbers
change each time the program is run, place a
Randomize
statement with no
argument at the beginning of the program.
RealTime
Used to pick out year, month, day, hour, minute, second, day of week, and/or day
of year from the CR9000 clock.
Syntax
RealTime(
Dest
)
Remarks
RealTime Example
This example uses
RealTime
to place all time segments in the Destination array. If the
remark (‘) is removed from the first 8 Sample statements and the last Sample statement is
remarked, the results will be exactly the same.
Public rTime(9)
'declare as public and dimension rTime to 9
Alias rTime(1) = Year
'assign the alias Year to rTime(1)
Alias rTime(2) = Month
'assign the alias Month to rTime(2)
Alias rTime(3) = Day
'assign the alias Day to rTime(3)
Alias rTime(4) = Hour
'assign the alias Hour to rTime(4)
Alias rTime(5) = Minute
'assign the alias Minute to rTime(5)
Alias rTime(6) = Second
'assign the alias Second to rTime(6)
Alias rTime(8) = WeekDay
'assign the alias WeekDay to rTime(8)
Alias rTime(9) = Day_of_Year
'assign the alias Day_of_Year to rTime(9)
DataTable (VALUES, 1, 100)
'set up data table
' Sample(1, Year, IEEE4)
'place Year in VALUES table
' Sample(1, Month, IEEE4)
'place Month in VALUES table
' Sample(1, Day, IEEE4)
'place Day in VALUES table
' Sample(1, Hour, IEEE4)
'place Hour in VALUES table
' Sample(1, Minute, IEEE4)
'place Minute in VALUES table
' Sample(1, Second, IEEE4)
'place Second in VALUES table
' Sample(1, WeekDay, IEEE4)
'place WeekDay in VALUES table
' Sample(1, Day_of_Year, IEEE4)
'place Day_of_Year in VALUES table
Sample(9, rTime(), IEEE4)
'place all 9 segments in VALUES table
EndTable
BeginProg
Scan (1, mSec, 0, 0)
RealTime(
rTime()
)
CallTable VALUES
Next Scan
EndProg
Summary of Contents for CR9000
Page 6: ...CR9000 Table of Contents iv This is a blank page ...
Page 22: ...CR9000 Overview OV 16 This is a blank page ...
Page 26: ...Section 1 Installation 1 4 CR9000 FIGURE 1 1 3 CR9000 Battery Pack ...
Page 72: ...Section 3 CR9000 Measurement Details 3 28 This is a blank page ...
Page 88: ...Section 5 Program Declarations 5 6 This is a blank page ...
Page 217: ...This is a blank page ...