This question is designed to provoke curiosity: A response is not required.
A key factor in testing is repeatability. To support this LR supports the introduction of a random seed value for the random number generator. Where would you look the change the random seed value for your load generators?
James Pulley, http://www.loadrunnerbythehour.com/PricingMatrix
Interesting question. You are talking about the srand() function, of course.
Normally, I try to ensure that the seed is unique, rather than
repeatably the same.
If more than one virtual user uses the same seed there is a risk that
both users will use exactly the same random values for their actions,
causing unwanted synchronisation of otherwise supposed-to-be-unique
actions. So the seed is usually calculated taking the vuser id and
virtual user group name into account.
As for repeatability between tests though - normally I simply trust
that the law of big numbers makes sure that on average the performed
set of actions is roughly the same. Making the test exactly repeatable
with many users is normally not an objective.
Therefore I use both a timestamp (of the current time) and the output
of the rand() function to add more entropy to the seed.
The resulting initialisation code can be found here:
https://github.com/randakar/y-lib/blob/master/y_loadrunner_utils.c#L58
(Note that I am open to improvements to this one - this code could
definitely be better)
I see where you are coming from with the repeatability argument
though. When you are dealing with tests that show intermittent, hard
to repeat error conditions making your test capable of performing
exactly the same set of steps with exactly the same test data each
time certainly should make life easier.
Regards,
Floris
---
'Many people asked me if I was afraid to fly and implied that I should
have stayed home, close to family and friends. I replied that if I had
stayed home, the terrorists would have won.
Unfortunately, my government does not agree with my definition of
winning. They think that living in fear and trying desperately to keep
us all 100% safe while flying is the most effective way to fight
terrorism. It reminds me of a boss that told me he liked it when
people lived in fear of being fired, they worked harder. I told him
being fired held no fear for me. When you live in fear, you do
irrational things - like sending millions of people's shoes through an
xray scanner every day.'
-- Stormy Peters
Implicit in this question is the understanding of a random seed, where and
why they [may|may not] be useful.
--
You received this message because you are subscribed to the Google
"LoadRunner" group.
To post to this group, send email to LR-Loa...@googlegroups.com
To unsubscribe from this group, send email to
LR-LoadRunne...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/LR-LoadRunner?hl=en
The thing is, this is a mailing list. Asking a question and not
expecting someone to write something is a bit naïve. So my apologies,
but I couldn't quite resist it.
Besides, as you yourself say, I haven't actually answered this.
> Implicit in this question is the understanding of a random seed, where and
> why they [may|may not] be useful.
Of course.
If you want to see some overkill, look at
https://github.com/randakar/y-lib/blob/master/y_loadrunner_utils.c#L58
then :p
That's actually not true.
The fact that loadrunner's random number generator is pseudo random
doesn't mean there can't be an implementation where the output of
rand() actually does contain a fair amount of randomness, or entropy.
Modern linux kernels for instance go to a lot of effort to mix various
hardware sources of entropy into the /dev/random device. Hardware
sources such as subtle variances in latencies in the CPU, which have
been shown to contain true randomness by academic researchers, network
behaviour, etc.
> Thus using a datetime stamp as a seed number helps in assuring a more
> random random number.
So yes, using a date/time stamp, the virtual user id, and the virtual
user group to seed the number generator in loadrunner does give you
more variation in the output of the random number generator, but it
doesn't actually help give you a truly random set of numbers. It's
still an algorithm at work. For true randomness you really do need to
resort to more elaborate measures.
Luckily I have never needed true randomness in LR so far :)