Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Create a random number starting with an alphabet
#4
Solved: 10 Years, 3 Months, 3 Weeks ago
Hi QTPmate,

Its simple.You can do it in a couple of ways.I am just presenting the logic.

For alphabets you would be getting it from Array so no problem for that.

For numbers what you can do is , you can use vbscript "Time" function which would return 3:26:54 , which you can split using ":" as delimiter , get it in array , then append array(0) , array(1) , which would give you a random number.

Here is the code which you can change accordingly

Code:
str_randomno=Time
Dim aftersplitting
aftersplitting=split(str_randomno,":")
print aftersplitting(0)&aftersplitting(1)&left(aftersplitting(2),2)

Thanks,
Gangadhar
Reply


Messages In This Thread
RE: Create a random number starting with an alphabet - by gangadhar - 07-30-2014, 04:11 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Random Values from Drop-Down profqa 5 6,015 12-06-2013, 09:01 AM
Last Post: basanth27
  Creating Random String SomeIntern 0 5,074 08-21-2013, 09:10 PM
Last Post: SomeIntern
  Random Number generator and verification problem jinnah 4 10,405 09-28-2012, 04:03 AM
Last Post: jinnah
  How to choose a random no from list alwarselvam 0 3,168 12-24-2011, 08:28 AM
Last Post: alwarselvam
  Starting QTP as a Windows Service adi_sesha 2 4,447 10-06-2010, 03:01 PM
Last Post: Pallavii

Forum Jump:


Users browsing this thread: 1 Guest(s)