Random values not selected in the request

I have created a sequence containing string values as below:

val possibleScope: Seq[String] = Seq(“full%20scope”, “simple%20scope”)val possibleFeature: Seq[String] = Seq(“IR_P_WI”, “IR_S_WI”, “GK_W_WI”, “GK_C_WI”, “ZUL_BEZ”)

I have created a function to select one of the values randomly.
def randomSelectionOfListedItems(listOfString:Seq[String]) : String = {
val random = new Random()
listOfString(random.nextInt(listOfString.length))
}

I have the scenario builder formed as below. I am calling the function to generate a random value to form the request URL:
.get(s"/ct-vt-transformer-dev-service/devicedata/query?factory=Frankfurt&scope=${randomSelectionOfListedItems(possibleScope)}&feature=${randomSelectionOfListedItems(possibleFeature)}

Then i ramp up the users as below:
setUp(
httpScenario.inject(
rampUsers(5) during 10.seconds,
rampUsers(5) during 10.seconds,
rampUsers(5) during 10.seconds
)
).protocols(httpConfig)

The problem that i am facing is, the URL is same for all the requests that are being generated. What is the mistake that i am doing here?

I figured it out right after posting the question here. This is the change i made:

.get(session => s"/ct-vt-transformer-dev-service/devicedata/query?factory=Frankfurt&scope=${randomSelectionOfListedItems(possibleScope)}&feature=${randomSelectionOfListedItems(possibleFeature)}

Glad you figured it out yourself. Indeed, you have to wrap in a function, otherwise the value is only computed once when loading the simulation.