Campbell Scientific CR5000 Measurement and Control Module User Manual
Page 200

Section 8. Processing and Math Instructions
8-28
Sub Zero
Count = 0
'Reset Count
Scan(10,mSec,0,100)
'Scan 100 times
BrFull(ZStrain,1,mV50,5,1,6,7,1,5000,1,0,0,100,1,0)
Count = Count + 1
'Increment Counter used By
DataTable
CallTable ZERO_1
'Zero_1 outputs on last scan
(Count=100)
Next Scan
ZStrain = ZERO_1.ZStrain_Avg(1,1)
'Set ZStrain = averaged
value
Flag(2) = True
End Sub
BeginProg
Scan(10,mSec,0,0)
'Scan 10(mSecs)
If Not Flag(2) Then Zero
BrFull(StMeas,1,mV50,5,1,6,7,1,5000,1,0,0,100,1,0)
StrainCalc(Strain,1,StMeas,ZStrain,-1,2,0)
CallTable STRAINS
'Strains outputs only when
Flag(1)=True
Next Scan
EndProg
Rnd
Returns a random number.
Syntax
Rnd [(number)]
Remarks
The argument number can be any valid numeric expression.
The Rnd function returns a Single value less than 1 but greater than or equal to
0.
The value of number determines how Rnd generates a random number:
Value of number
Number returned
< 0
The same number every time, as determined by number.
> 0
The next random number in the sequence.
= 0
The number most recently generated.
number omitted
The next random number in the sequence.
The same random-number sequence is generated each time the instruction is
encountered because each successive call to the Rnd function uses the previous
random number as a seed for the next number in the random-number sequence.
To have the program generate a different random-number sequence each time
it is run, use the Randomize statement without an argument to initialize the
random-number generator before Rnd is called.
To produce random integers in a given range, use this formula:
Int((upperbound - lowerbound + 1) * Rnd + lowerbound)