rand

Returns a random integer from the range of integers indicated by lowerlimit and upperlimit, inclusive.

An error occurs if either of lowerlimit or upperlimit is not a valid integer, or upperlimit is less than lowerlimit.

Syntax

   rand(lowerlimit, upperlimit)
Table 1. rand parameters
Parameter Type Description
lowerlimit Integer Any integer number representing the lesser limit of the random number's range.
upperlimit Integer Any integer number representing the higher limit of the random number's range.

Returns

A string containing the random integer, or an empty string if an error occurs.

Example

In this example, the result of rand is an integer in the range [45,90].

   <field sid="randTestField">
      <label>Test rand()</label>
      <format>
         <datatype>string</datatype>
         <constraints>
            <mandatory>on</mandatory>
         </constraints>
      </format>
      <value compute="rand('45', '90')"></value>
   </field>