Random Path Selection Router

:bullseye: What is your goal?

I want to create a scenario in which only one pathway is chosen in the router on random basis.

:thinking: What is the problem & what have you tried?

I have no idea how to set this up

:camera_with_flash: Screenshots (scenario flow, module settings, errors)

Hi,

This is a common scenario in Make, don’t worry :grinning_face_with_smiling_eyes: The key thing to know is that a Router by itself can’t choose a path randomly. It only follows filters.

What you can do instead is generate a random number first, and then let the router decide based on that value.

So, before the router, add a Tools → Set variable module and create something like randomPath = random(1;3) (assuming you have 3 routes).Then, on each router path, just add a filter: one checks if randomPath = 1, another = 2, another = 3.

Each time the scenario runs, Make will pick one number, and only the matching route will run. Simple and reliable.

If later you need more control, you can also do the same thing with a Switch module. Same idea, different UI.

Hope that helps! :+1:

Regards, Tony

so like this?

Almost. One small adjustment.

In the filter, don’t use “Contains”. Since random(1;3) returns a number, you should compare it as a number.

So on each route, set the filter like:

Route 1: randomPath equals 1

Route 2: randomPath equals 2

Route 3: randomPath equals 3

And make sure the variable you set before the router is exactly the same one you’re using in the filters.

Once you change that, it will work exactly as expected. Only one route will run per execution, chosen randomly

I would try to avoid duplicating similar modules across routes.

Instead, try to use the “Set Multiple Variables” or “Switch” module with the random number, so that you can insert dynamic values into subsequent module fields.

This makes it easier to maintain, modify, and extend your scenario.

— @samliew