Micro Focus QTP (UFT) Forums

Full Version: Generating Random number
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,
I am here with the hope of finding the syntax for generating the 10 digit random number to be stored in the global data sheet, so that it could be used some where else in the action. But next time when we run the same scrpt it should give other random number. I hope u understand.
Thanks for your help and time. Smile
Hi,

Use below Syntax.

Code:
iRandomValue = RandomNumber(1000000000,9999999999)

It will Generate a 10 Digit Random Value Exery time.

Other ways, you can write a Function with Length as Parameter which will Return a Random Value of your desired length.

The first one will be the easiest solution for you.

Hope this info will help you


Thanks

VENKATA
Code:
Randomize
Environment.Value("Client_No_Random")=Int((maxvalue - minvalue + 1) * Rnd) + minvalue

Randomize will make it to return a different number after every run ....

regards
Thank you very much VenkatReddy garu and Chennai Kishore garu.... both of your ideas were very useful for me.