# Nested randomSwitch?

**URL:** <https://community.gatling.io/t/nested-randomswitch/4556>\
**Category:** Gatling (Open-Source)\
**Created:** [October 8, 2018, 10:25am UTC](https://community.gatling.io/t/nested-randomswitch/4556 "2018-10-08T10:25:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eugene\_Abramchuk](https://avatars.discourse-cdn.com/v4/letter/e/8c91f0/32.png) [@Eugene\_Abramchuk](https://community.gatling.io/u/Eugene_Abramchuk)\
**Post date:** [October 8, 2018, 10:25am UTC](https://community.gatling.io/t/nested-randomswitch/4556/1 "2018-10-08T10:25:57Z")

</div>

Hi guys, anyone tried to do a nested random switch?

I am simulating a scenario which requires nested chance distribution, the scenario looks like this:

```auto
def scenarioBuilder: ScenarioBuilder = scenario(getClass.getSimpleName)
  .forever {
    randomSwitch(
      0.5 -> randomSwitch(
        0.5 -> exec(http("ActionA1-25%").get("/")),
        0.5 -> exec(http("ActionA2-25%").get("/"))
      ),
      0.5 -> exec(http("ActionB-50%").get("/"))
    )
  }

```

Thus I expected the results to be converging at 50% ActionB and 25% ActionA1 and ActionA2.

However in results ActionB gets some 99% requests and ActionA1 and ActionA2 only a few requests every now and then.

Is this even supported functionality?

Thanks

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [October 8, 2018, 11:10am UTC](https://community.gatling.io/t/nested-randomswitch/4556/2 "2018-10-08T11:10:23Z")

</div>

[https://gatling.io/docs/current/general/scenario/?highlight=randomswitch#randomswitch](https://gatling.io/docs/current/general/scenario/?highlight=randomswitch#randomswitch)

ratios are to be expressed in percents.

---

<div class="post-metadata">

**Author:** ![Eugene\_Abramchuk](https://avatars.discourse-cdn.com/v4/letter/e/8c91f0/32.png) [@Eugene\_Abramchuk](https://community.gatling.io/u/Eugene_Abramchuk)\
**Post date:** [October 10, 2018, 7:59am UTC](https://community.gatling.io/t/nested-randomswitch/4556/3 "2018-10-10T07:59:09Z")

</div>

Thanks Stephane, I overlooked it and in older versions (2.3) randomswitch distributed correctly even in the decimal notation.  
The test works well now. I also migrated to Gatling 3.0.0-RC3 and it works much faster than the older version (think 2.5x).
