Random Message Routing

Is there any node which has multiple outputs and which can route an incoming payload to anyone of the outputs randomly.

What about a Function node with some code to create the "randomness"?

that is possible but i have no luck in getting it right and working

You know what the next step is then :slight_smile:

Share what didn't work, so others can assist.

JSONata has a random function I think too so you could use the change node to add a random number to your incoming msg then use the switch node with a range of numbers.

I think there may be a random node as well. Have you checked the flows site?

1 Like

You could simply use my node-red-contrib-msg-router.
One of the many available routing algorithms is random routing.


And because everyone has "stepped in" to spoil my Function party :slightly_frowning_face:, you could achieve want you wanted in a Function node using math.random and a switch statement directing the msg randomly to x outputs. Just sayin' :wink: