Promotic

Random - method of the Pm object

Description:
Returns a random number in defined range.
Syntax:
Double Random(Double nLow, Double nHigh)
Parameters:
nLow(Double) bottom range limit
nHigh(Double) upper range limit
Note:
This method is functional also in Macro expression $.expr and in the onDraw event of the PmgCanvas object.
This method is also functional in Web panels.
Example1:
Computation of a random number in the range from 0 to 100 rounded to a integer
JavaScriptVBScriptSelect and copy to clipboard

var nVar = Pm.Round(Pm.Random(0, 100), 1);
Example2:
Emulation of "Temperature" value in defined range.
JavaScriptVBScriptSelect and copy to clipboard

var oVar = pMe.Pm("/Data/#vars/Temperature");
var nMin = 20;
var nMax = 100;
oVar.Value = oVar.Value + 0.1 * Pm.Random(nMin - oVar.Value, nMax - oVar.Value);

History:
Pm8.02.01: Created
PROMOTIC 9.0.18 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
Navigation:
 
- Pm
 
- Abs
- Cos
- E
- Exp
- LN2
- PI
- Pow
- Random
 
 
- Sin
- Tan
© MICROSYS, spol. s r. o.