Try out the following test structure:
- Thread Group (all defaults) 1 user, 1 second ramp-up, 1 loop)
- HTTP Request (see below for parameters)
Beanshell Pre Processor as a child of HTTP Request with the following code:
int min = Integer.parseInt(bsh.args[0]); // get first parameter
int max = Integer.parseInt(bsh.args[1]); // get second parameter
int random = min + (int) (Math.random() * ((max - min) + 1)); // calculate random number within parameters range
vars.put("RANDOM_NUMBER", String.valueOf(random)); // save result into RANDOM_NUMBER variable
and 100 300
in "Parameters: section
So in Beanshell Pre Processor we define RANDOM_NUMBER
variable value which we refer in HTTP Request Sampler. Pre Processor is being executed before request so variable gets populated. If you add View Results Tree listener you'll see that requests contain randomly generated numbers in 100-300 range
So you need to add Beanshell Pre Processor as a child of request you're going to parametrize.
See How to use BeanShell: JMeter's favorite built-in component guide for more information on Beanshell scripting and small cookbook.