How to Inserting random think time in TruClient web scripts?

  • Questions
  • How to Inserting random think time in TruClient web scripts?
Question ID: 107581
0
0

Hello,

I need to add random wait (think) times in my TruClient scripts

Any assistance would be greatly appreciated.

Marked as spam
Posted by (Questions: 216, Answers: 15)
Asked on April 21, 2017 4:26 pm
46 views
Answers (1)
0
Private answer

Random think times can be done using advanced JavaScript functionalities and these are the steps -

From 'Toolbox', copy a wait function and paste it before the web request.
In the argument section, replace the interval value '3? by 'Math.floor(11*Math.random()+5);'

The above function will return a random number between 5 and 15.

- Math.floor() method rounds a number DOWNWARDS to its nearest integer. (Eg. The output of code'Math.floor(1.8);'is1).
- Hence 11 is used as a multiplication factor so that an integer in the upper decimals of 10 will be rounded to 10.
- Math.random() methodreturns a random numberbetween0and 1.

![picture][1]

[1]: /storage/temp/609-random-thinktime.jpg

Marked as spam
Posted by (Questions: 12, Answers: 361)
Answered on April 21, 2017 4:35 pm