2
votes

I've got some user defined variables to which I allocate a random number using:

${__Random(1,100)}

I then run my test using 1 thread for 5 iterations. JMeter generates the same random number for each iteration.

How do I generate a new random number for each iteration?

2

2 Answers

1
votes

Add as first step of Thread Group a Flow Control Action

Put inside it a pre processor called User Parameters and click Add Variable

And put in it what you currently have in User Defined Variable

User Defined Variable

1
votes

User Defined Variables is a configuration element which means that:

  1. It is processed before any other elements
  2. It is processed once

So just use this __Random() function directly where required.

enter image description here

If you need to re-use the value in more than one place - amend your function call like:

${__Random(1,100,myValue)}

and after that declaration you will be able to refer random generated value as ${myValue}

enter image description here