Tricentis Tosca 16.0 Released on Feb-2023 ----- UFT has been upgraded from UFT 15.0.1 to UFT One 15.0.2, Beginning at November 2020.

Friday 3 July 2015

Rnd Function in Vbscript

Des: The Rnd function returns a random number. The number is always less than 1 but greater or equal to 0.

Syntax:
Rnd[(number)]

Parameter
Description
number
Optional. A valid numeric expression
If number is:
  • <0 - Rnd returns the same number every time
  • >0 - Rnd returns the next random number in the sequence
  • =0 - Rnd returns the most recently generated number
  • Not supplied - Rnd returns the next random number in the sequence


Examples:

1. Finding Random number
    Msgbox Rnd

2.Different types random numbers getting

    Randomze
    Msgbox Rnd

2. Finding Random number from given range of values.

    Dim max,min
    max=300
    min=4
Randomize
Msgbox Int((max-min+1)*rnd+min)


No comments:

Post a Comment

Note: only a member of this blog may post a comment.