How to use .doSwitch() more than once?

I try to do distribution with .doSwitch(), but selection works only once.

for example:

`
def getDistribValue () : String = {
var tempRandom = random.nextInt(100)
if (tempRandom < 60) return “1”
else if (tempRandom < 69) return “2”
else return “3”
}

val scn = scenario(“name”)
.doSwitch(getDistribValue ())(
1->exec(…),
2->exec(…),
3->exec(…)
)

setUp(scn.inject(
rampUsers(10) over(60))
.protocols(
http
.shareConnections
.disableCaching))
`

if getDistribValue() returned “1” scenario will be performed only once with value “1”.
How to avoid it? Am I using the wrong method to implement distribution?

What version of Gatling are you using? I don’t even see .doSwitch in the documentation. But you can accomplish what you are trying to do using randomSwitch.

.randomSwitch(
60 → exec( path 1 ),
9 → exec( path 2 ),
31 → exec( path 3 )
)

2.17. version.
Thanks for your answer.