RandomNumber Object
Description
Enables you to work with random number parameters.
You can generate a value for the specified random number parameter using the RandomNumber object.
Syntax
RandomNumber(ParameterNameOrStartNumber, [EndNumber])
Argument | Type | Description |
---|---|---|
ParameterNameOrStartNumber | Variant | You can specify two different types of values for this options: ParameterName—the name of a random number parameter that has already been defined in the Parameter Options or Value Configuration Options dialog box StartNumber— the start number for the range within which the random number is generated. |
EndNumber | Number | Relevant only when you specify a start number for the first argument. The end number for the range within which the random number is generated. Maximum allowable value is 2147483647. |
The following example generates a random number between 0 and 100.
x=RandomNumber (0,100)
The following example generates a random number using the random number settings defined in the MyRandom parameter.
x=RandomNumber("MyRandom")
Note: The above example works only if you have already defined a Random Number parameter called MyRandom in the Parameter Options or Value Configuration Options dialog box. For more details on defining random number parameters in these dialog boxes, see the UFT One User Guide.
Properties
Value | Checks that an object exists. |
Value Property
Description
Generates a value for the specified RandomNumber parameter.
Syntax
To generate any random number:
RandomNumber.Value(ParameterNameOrStartNumber, [EndNumber])
Argument | Type | Description |
---|---|---|
ParameterNameOrStartNumber | Variant | You can specify two different types of values for this options: ParameterName—the name of a random number parameter that has already been defined in the Parameter Options or Value Configuration Options dialog box StartNumber— the start number for the range within which the random number is generated. |
EndNumber | Number | Relevant only when you specify a start number for the first argument. The end number for the range within which the random number is generated. Maximum allowable value is 2147483647. |
Note: The Value property is the default property for the RandomNumber object.
The following example generates a random number between 0 and 100.
x=RandomNumber.Value(0,100)
The following example generates a random number using the random number settings defined in the MyRandom parameter.
x=RandomNumber.Value("MyRandom")
See also:
- Crypt Object
- DataTable Object
- Description Object
- DeviceReplay Object
- DotNetFactory Object
- DTParameter Object
- DTSheet Object
- Environment Object
- Extern Object
- Parameter Object
- JSON Object
- JsonUtil Object
- MercuryTimers Object (Collection)
- MercuryTimer Object
- NV Object
- OptionalStep Object
- ParallelUtil Object
- LocalParameter Object
- PasswordUtil Object
- PathFinder Object
- PDFUtil Object
- Properties Object (Collection)
- QCUtil Object
- RandomNumber Object
- Recovery Object
- Remote Connection Object
- Reporter Object
- RepositoriesCollection Object
- Repository Object
- Services Object
- Setting Object
- SystemMonitor Object
- TestArgs Object
- TextUtil Object
- UIAutomation Object
- VisualRelation Object
- VisualRelations Object
- VisualRelationsCollection Object
- WebUtil Object
- XMLUtil Object