DIAdem API Reference

Function: Random

  • 已更新2023-02-21
  • 閱讀時間為 2 分鐘

Determines random numbers in the value range from zero up to a specified value.

ReturnValue = Random(Limit)

Input Parameters

Limit Specifies a numeric value, a variable, or a data channel, to limit the value range.

Return Parameters

ReturnValueReturns random numeric values.

Examples

The following example determines a random number between 0 and 5.

VBScriptPython

 

Dim dblMyResult
dblMyResult = Random(5) 

The following example determines for each value of the Group1/Input data channel a random value between 0 and the channel value, and saves the random numbers in the Group2/Result data channel.

VBScriptPython

 

Call Calculate ("Ch(""Group2/Result"")= Random (Ch(""Group1/Input""))")
Note  You must use the Calculate command in scripts to calculate data channels with formulas. Compute the data channels according to the syntax in the Calculator. Refer to the procedures Executing Channel Calculations in the Calculator and Assigning a Value to a Variable in the Calculator for more information about the Calculator.
The physical input quantities and the result quantities are the same.
The Input and Result Quantities for Quantity-Based Calculations page contains an overview of the input quantities and result quantities of all functions. Refer to the Help page Calculating Quantity-Based and Non-Quantity-Based in DIAdem for the conditions and rules for quantity-based calculations.

Related Functions

Function: ^ | Function: Abs | Function: Ceil | Function: Deg | Function: Eex | Function: Exp | Function: Fak | Function: Floor | Function: Frac | Function: Lg | Function: Ln | Function: MaxV | Function: MinV | Function: Mod | Function: Rad | Function: Rnd | Function: Round | Function: RTP (Real To Part of Date) | Function: RTT (Real to Text) | Function: Sign | Function: SND | Function: Sqr | Function: Sqrt | Function: Trunc | Function: VU