Deep Patel: February 2012

Tuesday, February 28, 2012

Indians are Engineers at Heart!

The title comes from the commentary on ESPN Cricinfo during todays exciting match between India and Sri Lanka at Bellerive Oval, Australia.

The commentators were awesome throughout. Posting some comments i liked...

"Indians are Engineers..."
when Gambhir and Sachin were getting over Kulasekara and Mahroof


It looked like Gambhir and Kohli were slowing down a bit and the commentator said it...:D
take that Dhoni...



and when Gambhir was out he again said it...:D





Indian team is like rocket...
when boundaries flowed...



Tell the Americans...
we are world champions...





Brief summary of the match:

The Indian skipper had won the toss and decided to bowl first.
Sri Lanka dominated with the batting when the set a target of 321 for India.
India had to make this score in 40 overs to get a bonus point.
Considering the recent games and Sri Lanka's form, it looked like India would struggle to make it upto 321, but thanks to the awesome start given by The God! and Viru; the fluent batting by Gauti; and a match winning innings by Virat Kohli; the Indian team made it in just 36.4 overs.

It was a do or die for team India!
and we made it...we still have a hope to be in the finals. All depends on the match at Melbourne on 2nd March.

Screenshots taken from ESPN Cricifo

Monday, February 27, 2012

QTP Random Number Generation - RandomNumber.Value vs Rnd and Randomize

Recently I was facing a problem in generating Random numbers using QTP.

I started with QTP's inbuilt RandomNumber.Value(upperlimit,lowerlimit)

and the result was:

It would generate random numbers for that instance of QTP. But once QTP is restarted it will generate same numbers in same sequence. Example is shown in the images below.

The QTP always starts the Random Number Generation from the same number. To elaborate, QTP's Random Number function gets initialized with the same number(the seed) every time QTP's instance is created.

So for better performance we can use vb's Rnd function with call to Randomize. Call to Randomize initializes the Rnd function with a new seed value every time(this is based on the system time).
If Randomize is not used, Rnd uses the same number as a seed the first time it is called.
Hence it will generate the same value everytime the function is called.


Below are the results of all the cases. The execution 1 and execution 2 are of separate QTP instances.

Using QTP’s RandomNumber.Value(a,b) function.



Using vb’s Rnd function with Randomize.
This will generate random numbers every time!


Using vb’s Rnd function without Randomize.


Wondering what would happen on using Randomize with QTP's RandomNumber.Value(a,b) !!
Here are the results...

For more on Rnd Function follow check this link


For more on Randomize Function follow check this link